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
This feature is not backward compatible and creates a space in the anchor, which is not valid html.
if an anchor is set in the block editor, say "my-anchor".
if supports.anchor is set and an attribute "anchor" of type string is set in attributes in block.json
the resulting $block_wrapper_attributtes has an id of "my-anchor my-anchor"
Going back to 22.2.0 fixes the issue, but this means we cannot run the plugin for our own dynamic blocks. If there is a better way, please advise
Step-by-step reproduction instructions
in block.json set supports.anchor=true
in block.json set a string type attribute to hold the anchor
in render.php set the id of get_block_wrapper_attributes()
get_block_wrapper_attributes should automatically generate the id attribute based on the anchor data, so I believe you shouldn't need to add any arguments.
I don't think ID should be included in the attributes that get concatenated with a space. if a dev sets the ID in get_block_wrapper_attributes() that should not create additional spaces. that is not valid html
if the ID gets set automatically, and we are forced to use it, and we cannot manipulate it, and we cannot test for it later, you've taken away methods for developers to set the ID. this is important in places where no ID is set by an author, but some mechanism needs an ID. Again, this change is not backward compatible, so if other devs set the ID in get_block_wrapper_attributes, there will be a lot of blocks broken. This worked prior to 22.3 just fine.
I think this is a valid point. The ID (and maybe aria-label) is different from the other attributes in attributes_to_merge, as it must be unique and users might want to override it programmatically.
To maintain backward compatibility, we could update get_block_wrapper_attributes so that if it receives id, it is used instead of the native anchor.
Though I think similar blocks should also disablesupports.anchor, otherwise it will create a confusing UX.
changed the title [-]in adding anchor support for dynamic blocks, anchors are now doubled when ID is set in get_block_wrapper_attributes[/-][+]Block Supports: Don't merge unique attributes (ID, aria-label) in get_block_wrapper_attributes[/+]on Feb 5, 2026
Activity
t-hamano commentedon Feb 5, 2026
@hadamlenz Thanks for the report.
get_block_wrapper_attributesshould automatically generate theidattribute based on the anchor data, so I believe you shouldn't need to add any arguments.Could you try the code below?
hadamlenz commentedon Feb 5, 2026
I don't think ID should be included in the attributes that get concatenated with a space. if a dev sets the ID in get_block_wrapper_attributes() that should not create additional spaces. that is not valid html
hadamlenz commentedon Feb 5, 2026
if the ID gets set automatically, and we are forced to use it, and we cannot manipulate it, and we cannot test for it later, you've taken away methods for developers to set the ID. this is important in places where no ID is set by an author, but some mechanism needs an ID. Again, this change is not backward compatible, so if other devs set the ID in get_block_wrapper_attributes, there will be a lot of blocks broken. This worked prior to 22.3 just fine.
Mamaduka commentedon Feb 5, 2026
I think this is a valid point. The ID (and maybe
aria-label) is different from the other attributes inattributes_to_merge, as it must be unique and users might want to override it programmatically.To maintain backward compatibility, we could update
get_block_wrapper_attributesso that if it receivesid, it is used instead of the native anchor.Though I think similar blocks should also disable
supports.anchor, otherwise it will create a confusing UX.hadamlenz commentedon Feb 5, 2026
something like this is needed
t-hamano commentedon Feb 5, 2026
Thanks for the detailed explanation. Perhaps the following changes are needed in the core:
t-hamano commentedon Feb 5, 2026
Let's aim to fix this issue in the 7.0 release.
hadamlenz commentedon Feb 5, 2026
thanks yall!
[-]in adding anchor support for dynamic blocks, anchors are now doubled when ID is set in get_block_wrapper_attributes[/-][+]Block Supports: Don't merge unique attributes (ID, aria-label) in get_block_wrapper_attributes[/+]t-hamano commentedon Feb 5, 2026
@hadamlenz, your wordpress.org username is adrock42, correct? This is to ensure that all props are listed.
t-hamano commentedon Feb 5, 2026
Core ticket for tracking this issue: https://core.trac.wordpress.org/ticket/64603
hadamlenz commentedon Feb 5, 2026
that is correct