Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store merged data in memory #5024

Prev Previous commit
Next Next commit
Don't return early in get_theme_data
  • Loading branch information
joemcgill committed Sep 18, 2023
commit a5922fe8d41cf470ed67a8f42bc4cda10b3600fa
13 changes: 3 additions & 10 deletions src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
@@ -300,17 +300,10 @@ public static function get_theme_data( $deprecated = array(), $options = array()
return static::$theme;
}

$theme_support_data = self::get_theme_supports_data();
// Save theme supports data for future use.
static::$theme_support_data = self::get_theme_supports_data();

// If no support data has changed, return the previously cached object.
if ( $theme_support_data === static::$theme_support_data ) {
return static::$theme;
}

// Cache the merged theme support data for future use.
static::$theme_support_data = $theme_support_data;

$with_theme_supports = new WP_Theme_JSON( $theme_support_data );
$with_theme_supports = new WP_Theme_JSON( static::$theme_support_data );
$with_theme_supports->merge( static::$theme );
return $with_theme_supports;
}
Loading