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

Ignore cached wp_theme_has_theme_json when WP_DEBUG is enabled #45882

Merged
merged 2 commits into from
Nov 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ) &&
mmtr marked this conversation as resolved.
Show resolved Hide resolved
( 0 === $theme_has_support || 1 === $theme_has_support )
mmtr marked this conversation as resolved.
Show resolved Hide resolved
) {
return (bool) $theme_has_support;
}

Expand Down