Skip to content

Commit

Permalink
Add the global settings to the cache key recipe, so that when it chan…
Browse files Browse the repository at this point in the history
…ges, it invalidates the cache
  • Loading branch information
pereirinha committed Jan 4, 2024
1 parent 2377348 commit d707a79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,8 @@ protected static function compute_style_properties( $styles, $settings = array()
return $declarations;
}

$args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.Changed
// The global settings can include dynamic data related to typography. We need evaluate it so that the cache is invalidated when it changes.
$args = array( func_get_args(), wp_get_global_settings() ); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.Changed
$cache_key = 'compute_style_properties_' . md5( wp_json_encode( $args ) );
$cache = wp_cache_get( $cache_key, 'wp-styles' );

Expand Down

0 comments on commit d707a79

Please sign in to comment.