Does theme.json get cached? How can I clear it?

I set up a theme with a theme.json file and now I want to make some changes to it. I cannot get my changes to take... I am working in a local environment.

I am guessing its a caching problem but I cant figure out how to clear it.

  • I had the WP Rest Cache Plugin installed, using that to clear the rest cache didn't work. I deactivated it, still not seeing changes.
  • I read that toggling the current theme might work, that did not.
  • I am using wp-rig and when I render the production theme and switch to that, I do see my changes. When I switch back to my working copy, still no changes...

Has anyone else ran into this?

Topic theme.json Wordpress

Category Web


The answer is yes, it does get cached. I think the transient should get cleared when the theme is changed but that's not working in my local environment, I will have to dig into that another day.

From the function wp_get_global_stylesheet:

// Return cached value if it can be used and exists.
// It's cached by theme to make sure that theme switching clears the cache.
$can_use_cached = (
    ( empty( $types ) ) &&
    ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) &&
    ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) &&
    ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) &&
    ! is_admin()
);

Adding

define( 'SCRIPT_DEBUG', true );

To my local wp-config.php file is working for now...

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.