Opened 16 months ago
Closed 13 months ago
#59662 closed defect (bug) (invalid)
Clear block theme file caches when editing the theme in the Theme File Editor
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | |
Focuses: | performance | Cc: |
Description
As originally reported as part of https://core.trac.wordpress.org/ticket/59633#comment:7: Certain data from block theme files is being cached (either via object cache or transient, in different use-cases).
Any of these caches should be programmatically invalidated when editing the theme via the built-in Theme File Editor.
While for regular theme development the WP_DEVELOPMENT_MODE
constant (with a value of "theme") should be used, it is not reasonable to expect end users of WordPress that exclusively make use of the Theme File Editor to know about that.
Whenever files of a theme are being edited via the Theme File Editor, any of these caches (introduced between WordPress 6.2 and 6.4 so far) should be invalidated / cleared.
Change History (5)
This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.
14 months ago
#5
@
13 months ago
- Keywords needs-patch needs-unit-tests removed
- Milestone 6.5 deleted
- Resolution set to invalid
- Status changed from assigned to closed
- Version 6.2 deleted
Thanks @spacedmonkey, you're indeed right. I reviewed and tested this to verify: When editing a theme file, any cached data related to the theme are deleted (via WP_Theme::cache_delete()
method).
The only theme related cache not covered by this is the theme_json
object cache group. However, as this is a non-persistent group and doesn't operate on a specific theme but rather applies to whatever the current theme is, it is neither necessary nor appropriate to clear that cache when editing a theme file.
Per the above, I'll close this ticket as invalid (as it was already addressed before it was opened).
As of [56978], these caches will now only be persistent on environments using an object cache (e.g. Redis, Memcached) and will be cleared by a typical flush of the object cache. As we work on ways to extend this type of theme file caching for block themes (see: #59600), we will need to ensure editing these files via the Theme File Editor clears those caches.