Skip to content

Commit

Permalink
Ignore cached wp_theme_has_theme_json when WP_DEBUG is enabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmtr authored Nov 21, 2022
1 parent bbc5489 commit b55bd23
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/compat/wordpress-6.2/get-global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ function wp_theme_has_theme_json() {
$theme_has_support = wp_cache_get( $cache_key, $cache_group );

/**
* $theme_has_support is stored as a int in the cache.
* $theme_has_support is stored as an int in the cache.
*
* The reason not to store it as a boolean is to avoid working
* with the $found parameter which apparently had some issues in some implementations
* https://developer.wordpress.org/reference/functions/wp_cache_get/
*/
if ( 0 === $theme_has_support || 1 === $theme_has_support ) {
if (
// Ignore cache when `WP_DEBUG` is enabled, so it doesn't interfere with the theme developers workflow.
( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) &&
( 0 === $theme_has_support || 1 === $theme_has_support )
) {
return (bool) $theme_has_support;
}

Expand Down

0 comments on commit b55bd23

Please sign in to comment.