Make WordPress Core


Ignore:
Timestamp:
01/06/2023 10:34:00 AM (2 years ago)
Author:
spacedmonkey
Message:

Query: Stop priming posts twice in WP_Query.

Part revert of [54352]. In cases where queries are not split, then it results in priming posts that are already loaded resulting in a superfluous database query.

Props spacedmonkey, flixos90, peterwilsoncc.
Fixes #57373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-query.php

    r54962 r55035  
    34773477
    34783478            if ( $q['cache_results'] ) {
    3479                 $post_ids = wp_list_pluck( $this->posts, 'ID' );
    3480                 _prime_post_caches( $post_ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
     3479                update_post_caches( $this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
    34813480            }
    34823481
Note: See TracChangeset for help on using the changeset viewer.