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

Disable post meta/term cache updating for wp_global_styles #3655

Conversation

ocean90
Copy link
Member

@ocean90 ocean90 commented Nov 21, 2022

Neither post metas nor terms are used so this can be disabled to reduce the queries by one.

Trac ticket:


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@spacedmonkey
Copy link
Member

@ocean90 Can you confirm that this does remove queries.

Post meta is loaded. As this post is converted to an array, that loads post meta.
Screenshot 2022-11-21 at 14 32 25

@ocean90
Copy link
Member Author

ocean90 commented Nov 21, 2022

@spacedmonkey I haven't verified it on a clean install but I got one less term query on a client site. Will check again later, this was just for verifying if there are failing tests.

Though, it makes no sense to convert the post to an array. 😞 Only post_content and ID fields are actually used.

@spacedmonkey
Copy link
Member

Though, it makes no sense to convert the post to an array. 😞 Only post_content and ID fields are actually used.

I agree. How about manually converting this to an array. So

$user_cpt = array(
  'ID' => $post->ID, 
  'post_content' => $post->post_content,
);

This is a private method, so it is a little easier to change.

@spacedmonkey
Copy link
Member

@ocean90 This code is from gutenberg, it might be better to do this work in the gutenberg repo and it will be backported.

@ocean90
Copy link
Member Author

ocean90 commented Nov 22, 2022

@ocean90 This code is from gutenberg, it might be better to do this work in the gutenberg repo and it will be backported.

Thanks, created WordPress/gutenberg#45978 as a starting point.

@ocean90 ocean90 closed this Nov 22, 2022
@spacedmonkey
Copy link
Member

I have my own PR here - WordPress/gutenberg#46043

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants