Skip to content

Commit e278fe3

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56491 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 3d2f4d5 commit e278fe3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/post.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6105,8 +6105,8 @@ static function( $orderby_field ) {
61056105
*/
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+
$pages = new WP_Query();
6109+
$pages = $pages->query( $query_args );
61106110

61116111
if ( $child_of || $hierarchical ) {
61126112
$pages = get_page_children( $child_of, $pages );

0 commit comments

Comments
 (0)