You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Localize Text wraps empty block attribute values in a translation call #879
When Localize Text exports a block attribute whose value is an empty string, it wraps it in a translation call anyway. For example, an Excerpt block with an empty "Read more" text:
That adds an empty string to the theme's translatable strings, and WordPress Coding Standards flag it (WordPress.WP.I18n.NoEmptyStrings). We found three of these in a theme exported with Create Block Theme (the Excerpt blocks in its index, archive and search patterns).
The other two escape functions in the same file already return an empty string unchanged (escape_text_content() and escape_attribute(), "Check if string is empty.").
Steps to reproduce
With Create Block Theme 2.10.1 (the same code is on trunk):
Empty attribute values are left as they are, e.g. "moreText":"". A possible fix is to skip empty strings in escape_block_attribute_strings() (or in escape_block_attribute()), matching the other two functions.
Drafted with AI assistance, reproduced and verified by me.
Activity