Changeset 55185
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/global-styles-and-settings.php
r55155 r55185 234 234 */ 235 235 function wp_get_global_styles_svg_filters() { 236 / / Return cached value if it can be used and exists.237 // It's cached by theme to make sure that theme switching clears the cache.238 $can_use_cached = (239 ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) &&240 ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) &&241 ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) &&242 ! is_admin()243 );244 $ transient_name = 'global_styles_svg_filters_' . get_stylesheet();245 if ( $can_use_cached ) { 246 $cached = get_transient( $transient_name);236 /* 237 * Ignore cache when `WP_DEBUG` is enabled, so it doesn't interfere with the theme 238 * developer's workflow. 239 * 240 * @todo Replace `WP_DEBUG` once an "in development mode" check is available in Core. 241 */ 242 $can_use_cached = ! WP_DEBUG; 243 $cache_group = 'theme_json'; 244 $cache_key = 'wp_get_global_styles_svg_filters'; 245 if ( $can_use_cached ) { 246 $cached = wp_cache_get( $cache_key, $cache_group ); 247 247 if ( $cached ) { 248 248 return $cached; … … 261 261 262 262 if ( $can_use_cached ) { 263 // Cache for a minute, same as wp_get_global_stylesheet. 264 set_transient( $transient_name, $svgs, MINUTE_IN_SECONDS ); 263 wp_cache_set( $cache_key, $svgs, $cache_group ); 265 264 } 266 265 … … 368 367 function wp_clean_theme_json_cache() { 369 368 wp_cache_delete( 'wp_get_global_stylesheet', 'theme_json' ); 369 wp_cache_delete( 'wp_get_global_styles_svg_filters', 'theme_json' ); 370 370 wp_cache_delete( 'wp_get_global_settings_custom', 'theme_json' ); 371 371 wp_cache_delete( 'wp_get_global_settings_theme', 'theme_json' );
Note: See TracChangeset
for help on using the changeset viewer.