Query: Move call to update_menu_item_cache in WP_Query

Move call to `update_menu_item_cache` in `WP_Query` to after post meta caches for menu items are primed. 

Props spacedmonkey, peterwilsoncc, mukesh27.
See #55620.

git-svn-id: https://develop.svn.wordpress.org/trunk@54410 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonny Harris
2022-10-07 09:58:32 +00:00
parent f3c0f743b3
commit fd60449f92
2 changed files with 88 additions and 4 deletions

View File

@@ -3268,10 +3268,6 @@ class WP_Query {
wp_cache_set( $cache_key, $cache_value, 'posts' );
}
if ( ! empty( $this->posts ) && $q['update_menu_item_cache'] ) {
update_menu_item_cache( $this->posts );
}
if ( ! $q['suppress_filters'] ) {
/**
* Filters the raw post results array, prior to status checks.
@@ -3466,6 +3462,10 @@ class WP_Query {
$this->posts = array();
}
if ( ! empty( $this->posts ) && $q['update_menu_item_cache'] ) {
update_menu_item_cache( $this->posts );
}
if ( $q['lazy_load_term_meta'] ) {
wp_queue_posts_for_term_meta_lazyload( $this->posts );
}