Make WordPress Core

Changeset 56491

Timestamp:
08/29/2023 10:11:22 PM (11 months ago)
Author:
joemcgill
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.
Fixes #59224.

File:
1 edited

Legend:

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

    r56490 r56491  
    61066106    $query_args = apply_filters( 'get_pages_query_args', $query_args, $parsed_args );
    61076107
    6108     $query = new WP_Query( $query_args );
    6109     $pages = $query->get_posts();
     6108    $);
     6109    $pages = $);
    61106110
    61116111    if ( $child_of || $hierarchical ) {
Note: See TracChangeset for help on using the changeset viewer.