Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Styles: Use low-level cache for get_user_data_from_wp_global_styles #45634

Merged
merged 10 commits into from
Nov 9, 2022

Conversation

mmtr
Copy link
Contributor

@mmtr mmtr commented Nov 9, 2022

Backports changes from WordPress/wordpress-develop#3517

See also #44946 and https://core.trac.wordpress.org/ticket/56901

Proposed changes

This change removes caching of global styles for logged in users, allowing "wp_global_styles" custom post type to be imported completely, regardless of any previously cached data. This change now relies on the lower-level native WP_Query cache invalidation methods for the global styles post type.

Testing Instructions

  • Use Twenty Twenty Two (TT2) theme
  • Use WordPress 6.0.3
  • Log into the admin area
  • Go to Appearance > Editor
  • Open the Global Styles UI
  • Select "Browse Styles"
  • Select any non-default variation
  • Select "Save" to save the new global styles
  • Go back to the Dashboard
  • Go to Tools > Export
  • Click on "Download Export File" using "All content"
  • Using another local site, with WordPress 6.1 RC3 (where the issue The Issue with demo import with WP 6.1 #44946 is still present) and Gutenberg running this branch
  • Log into the admin area
  • Go to Tools > Import
  • Select "Install Now" for the "WordPress" importer
  • Select "Run Importer"
  • Select the XML file using "Choose File"
  • Click on the "Upload file and import" button
  • View site in the frontend
  • Make sure the styles use the non-default variation you selected

@mmtr mmtr requested a review from spacedmonkey as a code owner November 9, 2022 16:53
@codesandbox
Copy link

codesandbox bot commented Nov 9, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@mmtr mmtr self-assigned this Nov 9, 2022
@oandregal oandregal added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core labels Nov 9, 2022
Copy link
Member

@oandregal oandregal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

This backports code that is in core, both in 6.1 and trunk. I've done some testing and it works fine: using style variations in both new sites (no wp_global_styles CPT) and old sites; changing themes; using WordPress 6.1 and 6.0 as base.

I was unable to reproduce the bug with import content in Gutenberg trunk (the issue that was raised in 6.1 RC3). This change is worth doing anyway.

@mmtr mmtr merged commit a8cddf9 into trunk Nov 9, 2022
@mmtr mmtr deleted the update/global-styles-low-level-cache-user-data branch November 9, 2022 20:34
@github-actions github-actions bot added this to the Gutenberg 14.6 milestone Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants