From 3f5d5a5aabbbdd1687afe828a039828b5f5b880e Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 28 Jul 2022 15:32:32 +1000 Subject: [PATCH] Theme JSON Resolver: Update cache check to also check that the object is an instance of the Gutenberg version (#42756) * Theme JSON Resolver: Update cache check to also check that the object is an instance of the Gutenberg version * Add comment for when the resolver is backported to core --- lib/experimental/class-wp-theme-json-resolver-gutenberg.php | 3 ++- 1 file changed, 2 insertions(+), 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..a4d4e4dfc7066d 100644 --- a/lib/experimental/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/experimental/class-wp-theme-json-resolver-gutenberg.php @@ -33,7 +33,8 @@ public static function get_theme_data( $deprecated = array(), $settings = array( _deprecated_argument( __METHOD__, '5.9' ); } - if ( null === static::$theme ) { + // 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' ) ); $theme_json_data = gutenberg_add_registered_webfonts_to_theme_json( $theme_json_data );