[wp-trac] [WordPress Trac] #58650: Reset cache in development mode

WordPress Trac noreply at wordpress.org
Wed Jun 28 00:47:17 UTC 2023


#58650: Reset cache in development mode
------------------------------------+-----------------------------
 Reporter:  ramonopoly, noisysocks  |      Owner:  (none)
     Type:  feature request         |     Status:  new
 Priority:  normal                  |  Milestone:  Awaiting Review
Component:  Cache API               |    Version:
 Severity:  normal                  |   Keywords:
  Focuses:                          |
------------------------------------+-----------------------------
 https://core.trac.wordpress.org/ticket/57487 added support for development
 mode in order that the WordPress code is aware of different methods and
 levels of caching.

 Tests in the Gutenberg plugin utilize methods such as
 `wp_theme_has_theme_json`.

 In Core, this method checks the current development mode and deal with the
 cache accordingly.

 Because Gutenberg had not set the required constants, PHP unit tests were
 failing, probably because the cache was not being cleared between tests
 (`$can_use_cached` was always true).

 In order to get the tests running on the Gutenberg CI, the constant
 `WP_RUN_CORE_TESTS` needed to be declared in [Gutenberg's PHPUnit
 bootstrap file]https://github.com/WordPress/gutenberg/pull/51950/files
 #diff-a51f75ea7a86ddd18edea3fe94a0482427795fcd7b247e6959149cbac60964dfR27.

 PR: https://github.com/WordPress/gutenberg/pull/51950

 An alternative way suggested by @noisysocks was for Core to update Core's
 implementation of `wp_theme_has_theme_json` to cache the return value in a
 way that is reset by `wp_clean_theme_json_cache`.

 cc @flixos90

 Related discussion:

 https://github.com/WordPress/wordpress-
 develop/commit/4a16702090984caef24af5a07d598cc5afff2fdc#r119747488

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58650>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list