From f45aa20bcf97fe261506ccb434418c84cbf21045 Mon Sep 17 00:00:00 2001 From: Ramon Date: Tue, 18 Jun 2024 14:50:23 +1000 Subject: [PATCH] Theme JSON resolver: read theme.json files from the styles/ folder only once (#62638) Cache reading theme.json files from styles/ folder. Co-authored-by: ramonjd Co-authored-by: aaronrobertshaw --- lib/class-wp-theme-json-resolver-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 507876af4952a..f027e79d21047 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -761,7 +761,7 @@ public static function get_style_variations( $scope = 'theme' ) { } ksort( $variation_files ); foreach ( $variation_files as $path => $file ) { - $decoded_file = wp_json_file_decode( $path, array( 'associative' => true ) ); + $decoded_file = self::read_json_file( $path ); if ( is_array( $decoded_file ) && static::style_variation_has_scope( $decoded_file, $scope ) ) { $translated = static::translate( $decoded_file, wp_get_theme()->get( 'TextDomain' ) ); $variation = ( new WP_Theme_JSON_Gutenberg( $translated ) )->get_raw_data();