diff --git a/wp-includes/global-styles-and-settings.php b/wp-includes/global-styles-and-settings.php index ca3d8fabaa..b6c8c91b46 100644 --- a/wp-includes/global-styles-and-settings.php +++ b/wp-includes/global-styles-and-settings.php @@ -218,14 +218,18 @@ function wp_add_global_styles_for_blocks() { continue; } + $stylesheet_handle = 'global-styles'; if ( isset( $metadata['name'] ) ) { - $block_name = str_replace( 'core/', '', $metadata['name'] ); /* * These block styles are added on block_render. * This hooks inline CSS to them so that they are loaded conditionally * based on whether or not the block is used on the page. */ - wp_add_inline_style( 'wp-block-' . $block_name, $block_css ); + if ( str_starts_with( $metadata['name'], 'core/' ) ) { + $block_name = str_replace( 'core/', '', $metadata['name'] ); + $stylesheet_handle = 'wp-block-' . $block_name; + } + wp_add_inline_style( $stylesheet_handle, $block_css ); } // The likes of block element styles from theme.json do not have $metadata['name'] set. @@ -242,8 +246,11 @@ function wp_add_global_styles_for_blocks() { ) ); if ( isset( $result[0] ) ) { - $block_name = str_replace( 'core/', '', $result[0] ); - wp_add_inline_style( 'wp-block-' . $block_name, $block_css ); + if ( str_starts_with( $result[0], 'core/' ) ) { + $block_name = str_replace( 'core/', '', $result[0] ); + $stylesheet_handle = 'wp-block-' . $block_name; + } + wp_add_inline_style( $stylesheet_handle, $block_css ); } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index d2955b2a0e..c56d96a870 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54702'; +$wp_version = '6.2-alpha-54703'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.