diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-includes/block-supports/block-style-variations.php --- a/wp/wp-includes/block-supports/block-style-variations.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-includes/block-supports/block-style-variations.php Fri Sep 05 18:52:52 2025 +0200 @@ -8,21 +8,6 @@ */ /** - * 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. * * @since 6.6.0 @@ -77,7 +62,7 @@ } } /** - * Render the block style variation's styles. + * Renders the block style variation's styles. * * In the case of nested blocks with variations applied, we want the parent * variation's styles to be rendered before their descendants. This solves the @@ -124,7 +109,7 @@ */ 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"; @@ -209,15 +194,15 @@ } /** - * Ensure the variation block support class name generated and added to + * Ensures the variation block support class name generated and added to * block attributes in the `render_block_data` filter gets applied to the * block's markup. * - * @see wp_render_block_style_variation_support_styles - * * @since 6.6.0 * @access private * + * @see wp_render_block_style_variation_support_styles + * * @param string $block_content Rendered block content. * @param array $block Block object. * @@ -230,11 +215,9 @@ /* * 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;