Theme.json style variations not applied if the meta description is empty
-
The plugin appears to be breaking Theme.json styles, specifically for blocks that have style variations, and ONLY when the page/post has an empty Meta Description field.
The Theme.json configuration below renders the Paragraph blocks correctly in the Block Editor, but the front-end renders without the variation styles being applied. Adding any value to the Meta Description field fixes the issue and the block renders correctly. Removing the value from the Meta Description field also reverts the fix.
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"styles": {
"blocks": {
"core/paragraph": {
"variations": {
"eyebrow": {
"css": "border-radius: 0.5rem; display: inline-block;"
}
}
}
}
}
}Block styles have been registered in the functions.php file using the ‘init’ hook:
function register_block_styles() {
register_block_style('core/paragraph', [
'label' => 'Default',
'name' => 'default',
'is_default' => true,
]);
register_block_style('core/paragraph', [
'label' => 'Eyebrow',
'name' => 'eyebrow',
]);
}
add_action('init', 'register_block_styles');Tested in WordPress v6.8.3 and Yoast SEO v26.1.1 with all other plugins disabled.
You must be logged in to reply to this topic.