Auto show secondary titles not working with some titles
-
Hello,
there seems to be a problem when adding secondary titles to posts with (some?) special characters in the title. The secondary title won’t get auto shown.
For me the problem occurred in a post with the titleMai & Juni 2021
.By adding some debug output to function secondary_title_auto_show in hooks.php I identified the validate secondary title check as the problem’s cause.
This is my debug output:$title: Mai & #038 ; Juni 2021 [without spaces in the ampersand code] wptexturize( $post->post_title ): Mai & Juni 2021 $title !== wptexturize( $post->post_title ): 1
In
$title
the ampersand is encoded whilewptexturize(...)
returns it non encoded. The comparison is true and$standard_title
is returned instead of applying the secondary title.For fixing my problem I added passing
$title
throughhtmlspecialchars_decode()
. This converts& #038 ;
(without spaces) back to&
.
But will it work for the titles you had in mind when adding this condition?Maybe you could take my fix for the next version of your plugin or find a better way to make work auto showing of secondary titles in posts with special characters in the title.`
- The topic ‘Auto show secondary titles not working with some titles’ is closed to new replies.