mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-01-30 13:37:33 +00:00
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
This commit is contained in:
parent
3d2f4d5a88
commit
e278fe3fcf
@ -6105,8 +6105,8 @@ function get_pages( $args = array() ) {
|
||||
*/
|
||||
$query_args = apply_filters( 'get_pages_query_args', $query_args, $parsed_args );
|
||||
|
||||
$query = new WP_Query( $query_args );
|
||||
$pages = $query->get_posts();
|
||||
$pages = new WP_Query();
|
||||
$pages = $pages->query( $query_args );
|
||||
|
||||
if ( $child_of || $hierarchical ) {
|
||||
$pages = get_page_children( $child_of, $pages );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user