diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php index d4b50cd953..d4a4fda6a6 100644 --- a/wp-includes/class-wp-theme-json.php +++ b/wp-includes/class-wp-theme-json.php @@ -2821,6 +2821,7 @@ class WP_Theme_JSON { * Removes insecure data from theme.json. * * @since 5.9.0 + * @since 6.3.1 Preserves global styles block variations when securing styles. * * @param array $theme_json Structure to sanitize. * @return array Sanitized structure. @@ -2879,6 +2880,20 @@ class WP_Theme_JSON { if ( ! empty( $output ) ) { _wp_array_set( $sanitized, $metadata['path'], $output ); } + + if ( isset( $metadata['variations'] ) ) { + foreach ( $metadata['variations'] as $variation ) { + $variation_input = _wp_array_get( $theme_json, $variation['path'], array() ); + if ( empty( $variation_input ) ) { + continue; + } + + $variation_output = static::remove_insecure_styles( $variation_input ); + if ( ! empty( $variation_output ) ) { + _wp_array_set( $sanitized, $variation['path'], $variation_output ); + } + } + } } $setting_nodes = static::get_setting_nodes( $theme_json ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 1b43221210..ea0ea564cf 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56501'; +$wp_version = '6.4-alpha-56502'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.