Zero / 0 Inserted Between Tags

Hi,

I’ve noticed that a 0 is being inserted between tags at the bottom of posts. I’ve seen this reported here, but with no solution. I’ve tried going through each of my plugins and deactivating them one by one but to no avail. However, the issue seems to be within Sydney itself. Here’s what it looks like when the issue is present;

image

In inc/template-tags.php here’s the sydney_entry_footer function (line 109 in version 1.60);

function sydney_entry_footer() {
	// Hide category and tag text for pages.
	if ( 'post' == get_post_type() ) {
		/* translators: used between list items, there is a space after the comma */
		$tags_list = get_the_tag_list( '', __( '', 'sydney' ) );
		if ( $tags_list && is_single() ) {
			printf( '<span class="tags-links">' . __( ' %1$s', 'sydney' ) . '</span>', $tags_list );
		}
	}
	edit_post_link( __( 'Edit', 'sydney' ), '<span class="edit-link">', '</span>' );
}
endif;

The issue seems to be caused by __( '', 'sydney' ) in the call to get_the_tag_list. From my understanding, this attempts to translate an empty string within Sydney’s domain. There is supposedly a matching entry in sydney.pot which has a msgstr of "", but there is no associated msgid. As a result, I beleive this function will return back the requested value, which will be evaluated to null, and passes this to the second argument of Wordpress’s get_the_tag_list. The second argument is the separator to be used between tags and although this defaults to an empty string itself, I suspect the translation function is somehow converting the empty string to a null value and then passing this in as the separator. During the course of this, PHP attempts to evaluate null as a string and casts it to ‘0’. Hence, there is now a tag separator of 0. I may be slightly wrong in this as PHP and Wordpress development isn’t my area of expertise but this series of events makes logical sense to me.

If I edit the code as follows so that a space is requested for translation instead of an empty/null string, then the zero disappears and a space is used instead.

$tags_list = get_the_tag_list( '', __( ' ', 'sydney' ) );

(I am not able to insert a screenshot showing this as new users are limited to one image per post, but it’s the same as the previous screenshot but with a blank space between the tags rather than a 0!)

Hello there,

Please try reinstalling Sydney theme and see if it makes any difference.

Regards,
Kharis
aThemes Support

I’ve got the same problem on two of my websites!
So I set up a clean new test system with only two postings and three keywords!

No extra Plugins installed except “Elementor” and “Sydney Toolbox” for the sydney theme.

Please see screenshot :wink:

Any solutions?

For comparison - same with 2020 Theme:

Hi,

The issue persists even after a completely fresh install of the theme. The cause of the error looks to be in Sydney’s code, as explained in my original post. I can manually modify the code to fix the error, but if I do I lose it after every update - and it also doesn’t fix the issue for others who have also replied to this thread.

Would you be able to review the details my first post? I’ve tried to explain the bug in the code as best I can. When I apply my fix single-character fix to that bit of code the issue is resolved.

Many thanks.

Hello there,

As checked with my test site, that issue doesn’t seem to happen.

Perhaps one of your active plugins adds extra CSS code that is causing you to have ‘0’ between tags. Try temporarily disable all active plugins (except the required ones) to rule out plugin-specific issue. If you get it appears fine, then, to narrow down the source of the issue, deactivate them one by one and run your test in each.

Regards,
Kharis
aThemes Support

On your test site, could you try changing your Site Language (Settings > General) to English (UK) and try again? If I change my site’s language to English (US), do I not get this issue, but with English (UK) I do. Given the language in @BeamMeToSydney’s screenshot, I imagine they’re also not using English (US) and hence also running in to the issue.

Yes, its language dependent… US English everything is normal!

wordpress_sydney_posting_keyword_tag_zero-us-english

1 Like

I still got no issue running on English (UK). Which version of Sydney are you running? Is it the latest?

Regards,
Kharis
aThemes Support

Yes, i’m running the latest version of Sydney - 1.60. Wordpress itself is version 5.3.2 and PHP version 7.4.3.

Here it’s WordPress 5.3.2, Sydney Toolbox 1.09 and Sydney 1.60…
Effect is switchable:
German language -> “0” Sepearator
US English lang.-> “0” disappears.

Hello there,

I presumed that relates with translation file on a specific locale, English (UK).

https://translate.wordpress.org/projects/wp-themes/sydney/en-gb/default/

We’ll be investigating it with our development team. We’ll be updating you as soon as possible.

Regards,
Kharis
aThemes Support

Hey guys,

I can’t replicate this issue either, regardless of language, so it’s probably environment specific. We’re just going to remove the translation function in the next update as it isn’t required anyway and this should fix the issue.

Vlad

2 Likes

Many thanks @vlad, looking forward to the next update (as an unrelated bit of positive feedback - the removal of FontAwesome in the 1.59 update did wonders for our performance metrics, so thanks to all of the devs for their hard work on this!).

On a whim, I’ve just had a look through Wordpress’s bug tracker and it seems that someone has reported an issue with null/empty strings being translated to ‘0’ back in 2017. A patch was submitted to verify the behaviour via unit testing, but as far as I can see no fix was ever submitted to Wordpress core.

Great, happy to hear that. We actually have another performance update planned.

1 Like