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

Conversation

mmtr
Copy link
Contributor

@mmtr mmtr commented Nov 18, 2022

Follows up #45543

What?

This PR updates the wp_theme_has_theme_json so it ignores the cache when WP_DEBUG is enabled.

Why?

Testing Instructions

TBD

@mmtr mmtr added [Type] Performance Related to performance efforts Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Developer Experience Ideas about improving block and theme developer experience labels Nov 18, 2022
@mmtr mmtr requested review from oandregal and felixarntz November 18, 2022 10:00
@mmtr mmtr requested a review from spacedmonkey as a code owner November 18, 2022 10:00
@mmtr mmtr self-assigned this Nov 18, 2022
@codesandbox
Copy link

codesandbox bot commented Nov 18, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in terms of just fixing the problem here, although we may want to consider a more holistic situation.

How about introducing a function like wp_theme_debug_enabled() which returns this as a boolean, which we can use in any places where we use caching around theme-powered code? At a minimum the function could be the WP_DEBUG check we've been starting to use, but potentially it should go further with e.g. additionally having a filter to control it so that it can be dynamically set or modified at runtime.

@mmtr mmtr merged commit b55bd23 into trunk Nov 21, 2022
@mmtr mmtr deleted the update/wp-theme-has-theme-json-ignore-cache-wp-debug branch November 21, 2022 11:31
@mmtr mmtr restored the update/wp-theme-has-theme-json-ignore-cache-wp-debug branch November 21, 2022 11:31
@mmtr mmtr deleted the update/wp-theme-has-theme-json-ignore-cache-wp-debug branch November 21, 2022 11:31
@github-actions github-actions bot added this to the Gutenberg 14.7 milestone Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants