-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
[Package] Blocks/packages/blocks/packages/blocks[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] WP Core TicketRequires an upstream change from WordPress. Core Trac ticket should be linked.Requires an upstream change from WordPress. Core Trac ticket should be linked.
Description
Description
I created a block, the settings are below in the block.json.
The block should have a full width alignment by default (mentioned here in the documentation: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align)
This works good in the editor. But in my render file, the get_block_wrapper_attributes()
function is not outputting the align class.
The align class is only returned when I configure another block width then the one that’s in the attributes (so ‘none’ or ‘wide’). The default alignment is never returned, even after toggling another one and going back to the default alignment.
block.json:
{
...
"attributes": {
"align": {
"type": "string",
"default": "full"
}
...
},
"supports": {
"html": false,
"align": [
"wide",
"full"
],
...
},
...
}
Step-by-step reproduction instructions
- Configure a block to have a specific alignment (i.e. 'full') by adding it as a default value in attributes.align in block.json;
- Configure and create a PHP render template file in block.json;
- Use
get_block_wrapper_attributes()
to output the classes in the wrapper div; - Add the block to the editor and leave the default alignment configured, save the editor;
- Check the classes being output in the front-end, the configured alignment will not be in the list that's being returned by
get_block_wrapper_attributes()
.
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress 6.2, Gutenberg 15.6.2, custom template (full site editing boilerplate)
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Metadata
Metadata
Assignees
Labels
[Package] Blocks/packages/blocks/packages/blocks[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] WP Core TicketRequires an upstream change from WordPress. Core Trac ticket should be linked.Requires an upstream change from WordPress. Core Trac ticket should be linked.