-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add caching to WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type() #36584
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @xknown! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, @xknown.
The code looks good to me. Let's rebase on the current trunk and merge this once all checks are green.
…ustom_post_type Refactor `WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type` to add caching to the `wp_global_styles` post type lookup, and also to remove the duplicate code added in `gutenberg_add_active_global_styles_link`. Fixes #36574
Thanks for the review/feedback. I rebased the PR branch. |
Thank you, @xknown. |
Congratulations on your first merged pull request, @xknown! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
Is this something that need to be backported in core for 5.9? cc @oandregal @jorgefilipecosta |
…ustom_post_type() (#36584) * Add caching to WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type Refactor `WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type` to add caching to the `wp_global_styles` post type lookup, and also to remove the duplicate code added in `gutenberg_add_active_global_styles_link`. Fixes #36574 * Add unit tests * Use the correct query filter * Use wp_cache_set instead of wp_cache_add. * Remove the filter when finished. * Simplify the if blocks
A heads up that I cherry-picked this into the gutenberg 12.0.1 point release. |
If we don't backport it then it will be deleted when Gutenberg requires WP 5.9 at minimum, no? |
The changes in |
@youknowriad Without having looked deeply into the code, I'd think it's best to do it, yes: it changes some public method we're merging in 5.9 for the first time. While it is from a "private/internal" class, I'd rather play it safe. |
…ustom_post_type() (#36584) * Add caching to WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type Refactor `WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type` to add caching to the `wp_global_styles` post type lookup, and also to remove the duplicate code added in `gutenberg_add_active_global_styles_link`. Fixes #36574 * Add unit tests * Use the correct query filter * Use wp_cache_set instead of wp_cache_add. * Remove the filter when finished. * Simplify the if blocks
Refactor
WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type
to add caching to the
wp_global_styles
post type lookup, and also toremove the duplicate code added in
gutenberg_add_active_global_styles_link
.Fixes #36574
Description
How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).