[wp-trac] [WordPress Trac] #58758: Cached result for wp_theme_has_theme_json() is not invalided when theme is switched dynamically
WordPress Trac
noreply at wordpress.org
Mon Jul 10 19:15:51 UTC 2023
#58758: Cached result for wp_theme_has_theme_json() is not invalided when theme is
switched dynamically
--------------------------+---------------------------
Reporter: westonruter | Owner: spacedmonkey
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.3
Component: Themes | Version: 6.2
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: performance
--------------------------+---------------------------
Changes (by spacedmonkey):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"56185" 56185]:
{{{
#!CommitTicketReference repository="" revision="56185"
Themes: Improved caching in `wp_theme_has_theme_json()`.
Improve logic in `wp_theme_has_theme_json()` to improve caching soo it
takes into account that a theme can be switched. Before this function
would overly cache if the current theme has a theme.json file. Now it use
the value of `get_stylesheet()` as a key to an array. This way, if the
value of stylesheet is changed, by either a filter or in a unit test, a
new check to see if the file exists is run. For this reason, the
workaround to check if unit tests are running by checking if
`WP_RUN_CORE_TESTS` constant exists can be removed.
Props westonruter, spacedmonkey, flixos90.
Fixes #58758.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58758#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list