diff --git a/wp-includes/block-supports/block-style-variations.php b/wp-includes/block-supports/block-style-variations.php index 2e86cb71af..4397a34af9 100644 --- a/wp-includes/block-supports/block-style-variations.php +++ b/wp-includes/block-supports/block-style-variations.php @@ -7,21 +7,6 @@ * @since 6.6.0 */ -/** - * Generate block style variation instance name. - * - * @since 6.6.0 - * @access private - * - * @param array $block Block object. - * @param string $variation Slug for the block style variation. - * - * @return string The unique variation name. - */ -function wp_create_block_style_variation_instance_name( $block, $variation ) { - return $variation . '--' . md5( serialize( $block ) ); -} - /** * Determines the block style variation names within a CSS class string. * @@ -124,7 +109,7 @@ function wp_render_block_style_variation_support_styles( $parsed_block ) { */ wp_resolve_block_style_variation_ref_values( $variation_data, $theme_json ); - $variation_instance = wp_create_block_style_variation_instance_name( $parsed_block, $variation ); + $variation_instance = wp_unique_id( $variation . '--' ); $class_name = "is-style-$variation_instance"; $updated_class_name = $parsed_block['attrs']['className'] . " $class_name"; @@ -230,11 +215,9 @@ function wp_render_block_style_variation_class_name( $block_content, $block ) { /* * Matches a class prefixed by `is-style`, followed by the - * variation slug, then `--`, and finally a hash. - * - * See `wp_create_block_style_variation_instance_name` for class generation. + * variation slug, then `--`, and finally an instance number. */ - preg_match( '/\bis-style-(\S+?--\w+)\b/', $block['attrs']['className'], $matches ); + preg_match( '/\bis-style-(\S+?--\d+)\b/', $block['attrs']['className'], $matches ); if ( empty( $matches ) ) { return $block_content; diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 457b7fc136..be92ba6796 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -6387,3 +6387,21 @@ function wp_enqueue_global_styles_custom_css() { wp_add_inline_style( 'global-styles', $custom_css ); } } + +/** + * Generate block style variation instance name. + * + * @since 6.6.0 + * @deprecated 6.7.0 Use `wp_unique_id( $variation . '--' )` instead. + * + * @access private + * + * @param array $block Block object. + * @param string $variation Slug for the block style variation. + * + * @return string The unique variation name. + */ +function wp_create_block_style_variation_instance_name( $block, $variation ) { + _deprecated_function( __FUNCTION__, '6.7.0', 'wp_unique_id' ); + return $variation . '--' . md5( serialize( $block ) ); +} diff --git a/wp-includes/version.php b/wp-includes/version.php index a18d4771e3..58d205bc82 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-58950'; +$wp_version = '6.7-alpha-58951'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.