diff --git a/wp-includes/class-wp-theme-json-data.php b/wp-includes/class-wp-theme-json-data.php index 6aa8a3971c..30dab47185 100644 --- a/wp-includes/class-wp-theme-json-data.php +++ b/wp-includes/class-wp-theme-json-data.php @@ -69,4 +69,15 @@ class WP_Theme_JSON_Data { public function get_data() { return $this->theme_json->get_raw_data(); } + + /** + * Returns theme JSON object. + * + * @since 6.6.0 + * + * @return WP_Theme_JSON The theme JSON structure stored in this data object. + */ + public function get_theme_json() { + return $this->theme_json; + } } diff --git a/wp-includes/class-wp-theme-json-resolver.php b/wp-includes/class-wp-theme-json-resolver.php index 3ad5ecf0c4..59c5f54b96 100644 --- a/wp-includes/class-wp-theme-json-resolver.php +++ b/wp-includes/class-wp-theme-json-resolver.php @@ -173,8 +173,7 @@ class WP_Theme_JSON_Resolver { * @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_default', new WP_Theme_JSON_Data( $config, 'default' ) ); - $config = $theme_json->get_data(); - static::$core = new WP_Theme_JSON( $config, 'default' ); + static::$core = $theme_json->get_theme_json(); return static::$core; } @@ -255,8 +254,7 @@ class WP_Theme_JSON_Resolver { * @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_theme', new WP_Theme_JSON_Data( $theme_json_data, 'theme' ) ); - $theme_json_data = $theme_json->get_data(); - static::$theme = new WP_Theme_JSON( $theme_json_data ); + static::$theme = $theme_json->get_theme_json(); if ( $wp_theme->parent() ) { // Get parent theme.json. @@ -387,9 +385,7 @@ class WP_Theme_JSON_Resolver { * @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_blocks', new WP_Theme_JSON_Data( $config, 'blocks' ) ); - $config = $theme_json->get_data(); - - static::$blocks = new WP_Theme_JSON( $config, 'blocks' ); + static::$blocks = $theme_json->get_theme_json(); return static::$blocks; } @@ -523,8 +519,7 @@ class WP_Theme_JSON_Resolver { * @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data( $config, 'custom' ) ); - $config = $theme_json->get_data(); - return new WP_Theme_JSON( $config, 'custom' ); + return $theme_json->get_theme_json(); } /* @@ -543,8 +538,7 @@ class WP_Theme_JSON_Resolver { /** This filter is documented in wp-includes/class-wp-theme-json-resolver.php */ $theme_json = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data( $config, 'custom' ) ); - $config = $theme_json->get_data(); - static::$user = new WP_Theme_JSON( $config, 'custom' ); + static::$user = $theme_json->get_theme_json(); return static::$user; } diff --git a/wp-includes/version.php b/wp-includes/version.php index e0f42df094..e190b872dc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.6-alpha-58184'; +$wp_version = '6.6-alpha-58185'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.