[wp-trac] [WordPress Trac] #56901: WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles is incorrectly cached.
WordPress Trac
noreply at wordpress.org
Tue Oct 25 00:52:52 UTC 2022
#56901: WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles is incorrectly
cached.
---------------------------+-----------------------------
Reporter: peterwilsoncc | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version:
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
This ticket is for tacking the WordPress-Develop changes required for
[https://github.com/WordPress/gutenberg/issues/44946
WordPress/gutenberg#44946].
From the original report:
> When importing demo content using WP 6.1 styles are not imported
correctly although the same works fine in WP 6.0.2.
>
> Imported content displays the theme's default colors and styling instead
of the styling set for that particular demo. However, in the "Site Editor"
styles are correctly displayed. Sometimes when I exit the Site Editor the
styles are then correctly displayed in the front end as well, but
sometimes it takes a few tries.
>
> This issue happens with the WordPress default importer as well as our
theme's built-in import system.
Please see the Gutenberg repo's ticket for further details and discussion.
During investigation, it was discovered to be a cache invalidation issue.
The caching within the `get_user_data_from_wp_global_styles()` method was
not cleared when new custom styles posts were created.
The [https://github.com/WordPress/wordpress-develop/pull/3517 linked pull
request] switches the caching to use the lower-level caching provided by
`WP_Query`. This provides two advantages:
* removes duplicate caching of the same data
* cache invalidation is managed at the lower level
**Committers** Please review
[https://github.com/WordPress/gutenberg/issues/44946
WordPress/gutenberg#44946] when generating the props list for this ticket.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56901>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list