Make WordPress Core

Changeset 56516


Ignore:
Timestamp:
09/05/2023 08:43:43 PM (9 months ago)
Author:
flixos90
Message:

Posts, Post Types: Avoid redundant SQL query in get_pages().

This avoids an additional query by passing the query args directly to the WP_Query::query() method, rather than to the constructor and calling get_posts(), following [55569].

Props david.binda, azaozz, spacedmonkey, mukesh27, flixos90, SergeyBiryukov, joemcgill.
Merges [56491] to the 6.3 branch.
Fixes #59224.

Location:
branches/6.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.3

  • branches/6.3/src/wp-includes/post.php

    r56200 r56516  
    60926092    $query_args = apply_filters( 'get_pages_query_args', $query_args, $parsed_args );
    60936093
    6094     $query = new WP_Query( $query_args );
    6095     $pages = $query->get_posts();
     6094    $pages = new WP_Query();
     6095    $pages = $pages->query( $query_args );
    60966096
    60976097    if ( $child_of || $hierarchical ) {
Note: See TracChangeset for help on using the changeset viewer.