Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Jun 25, 2023
1 parent 89676d8 commit 870e523
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/wp-includes/block-supports/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function _wp_add_block_level_presets_class( $block_content, $block ) {
* @internal
*
* @since 6.2.0
* @since 6.3.0 Updates preset styles to use Selectors API.
* @access private
*
* @param string|null $pre_render The pre-rendered content. Default null.
Expand Down Expand Up @@ -95,11 +96,14 @@ function _wp_add_block_level_preset_styles( $pre_render, $block ) {
$registry = WP_Block_Type_Registry::get_instance();
$blocks = $registry->get_all_registered();
foreach ( $blocks as $block_type ) {
if (
isset( $block_type->supports['__experimentalSelector'] ) &&
is_string( $block_type->supports['__experimentalSelector'] )
) {
$variables_root_selector .= ',' . $block_type->supports['__experimentalSelector'];
// We only want to append selectors for block's using custom selectors
// i.e. not `wp-block-<name>`.
$has_custom_selector =
( isset( $block_type->supports['__experimentalSelector'] ) && is_string( $block_type->supports['__experimentalSelector'] ) ) ||
( isset( $block_type->selectors['root'] ) && is_string( $block_type->selectors['root'] ) );

if ( $has_custom_selector ) {
$variables_root_selector .= ',' . wp_get_block_css_selector( $block_type );
}
}
$variables_root_selector = WP_Theme_JSON::scope_selector( $class_name, $variables_root_selector );
Expand Down

0 comments on commit 870e523

Please sign in to comment.