From d5922de0f0719e79a0e0dddb79d015e008833156 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 28 Jul 2022 14:35:07 +1000 Subject: [PATCH 1/2] Theme JSON Resolver: Update cache check to also check that the object is an instance of the Gutenberg version --- lib/experimental/class-wp-theme-json-resolver-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/experimental/class-wp-theme-json-resolver-gutenberg.php b/lib/experimental/class-wp-theme-json-resolver-gutenberg.php index adf5803de561aa..9f67b47a3e27f2 100644 --- a/lib/experimental/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/experimental/class-wp-theme-json-resolver-gutenberg.php @@ -33,7 +33,7 @@ public static function get_theme_data( $deprecated = array(), $settings = array( _deprecated_argument( __METHOD__, '5.9' ); } - if ( null === static::$theme ) { + if ( null === static::$theme || ! static::$theme instanceof WP_Theme_JSON_Gutenberg ) { $theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) ); $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) ); $theme_json_data = gutenberg_add_registered_webfonts_to_theme_json( $theme_json_data ); From 3673bc87fe550ebd0e20e939d8444d1cc385fb10 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 28 Jul 2022 14:47:12 +1000 Subject: [PATCH 2/2] Add comment for when the resolver is backported to core --- lib/experimental/class-wp-theme-json-resolver-gutenberg.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/experimental/class-wp-theme-json-resolver-gutenberg.php b/lib/experimental/class-wp-theme-json-resolver-gutenberg.php index 9f67b47a3e27f2..a4d4e4dfc7066d 100644 --- a/lib/experimental/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/experimental/class-wp-theme-json-resolver-gutenberg.php @@ -33,6 +33,7 @@ public static function get_theme_data( $deprecated = array(), $settings = array( _deprecated_argument( __METHOD__, '5.9' ); } + // When backporting to core, remove the instanceof Gutenberg class check, as it is only required for the Gutenberg plugin. if ( null === static::$theme || ! static::$theme instanceof WP_Theme_JSON_Gutenberg ) { $theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) ); $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) );