-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Disable post meta/term cache updating in WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles() #45978
Copy link
Copy link
Closed
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] PerformanceRelated to performance effortsRelated to performance efforts
Description
Description
Initially started in WordPress/wordpress-develop#3655.
The method currently returns a full WP_Post array while later only the ID and post_content fields are used. That's causing a lot of unnecessary overhead.
To fix this the WP_Query should be updated to disable update_post_meta_cache and update_post_term_cache. Also, any get_post( $x, ARRAY_A ); calls should be changed to just get_post( $x ) so that WP_Post::to_array() isn't called, preventing post meta lookups. Then we can create a custom array that only includes the two fields ID and post_content as proposed by @spacedmonkey.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] PerformanceRelated to performance effortsRelated to performance efforts
Type
Fields
Give feedbackNo fields configured for issues without a type.