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/tests/phpunit/tests/post/nav-menu.php

    r54410 r55035  
    299299        wp_get_nav_menu_items( $this->menu_id );
    300300        $queries_made = get_num_queries() - $start_num_queries;
    301         $this->assertSame( 7, $queries_made, 'Only does 7 database queries when running wp_get_nav_menu_items.' );
     301        $this->assertSame( 6, $queries_made, 'Only does 6 database queries when running wp_get_nav_menu_items.' );
    302302
    303303        $args = $action->get_args();
     
    340340        wp_get_nav_menu_items( $this->menu_id );
    341341        $queries_made = get_num_queries() - $start_num_queries;
    342         $this->assertSame( 7, $queries_made, 'Only does 7 database queries when running wp_get_nav_menu_items.' );
     342        $this->assertSame( 6, $queries_made, 'Only does 6 database queries when running wp_get_nav_menu_items.' );
    343343
    344344        $args = $action_terms->get_args();
Note: See TracChangeset for help on using the changeset viewer.