Editor: fix classname output on blocks without layout.

Prevents layout classnames from being output on blocks with no layout support and no child layout classnames by returning early from `wp_render_layout_support_flag`.

Props andrewserong.
Fixes #60292.


git-svn-id: https://develop.svn.wordpress.org/trunk@57328 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Isabel Brison
2024-01-23 05:36:40 +00:00
parent 3c4fbc353f
commit c9f04d4053
2 changed files with 23 additions and 0 deletions
@@ -615,6 +615,9 @@ function wp_render_layout_support_flag( $block_content, $block ) {
$processor->add_class( $class_name );
}
return $processor->get_updated_html();
} elseif ( ! $block_supports_layout ) {
// Ensure layout classnames are not injected if there is no layout support.
return $block_content;
}
$global_settings = wp_get_global_settings();