Make WordPress Core


Ignore:
Timestamp:
10/04/2022 03:31:04 AM (19 months ago)
Author:
peterwilsoncc
Message:

Posts, Post types: Prevent get_page_by_title() parsing query twice.

In get_page_by_title() access the populated WP_Query::posts property directly rather than via the WP_Query::get_posts() method. This removes unnecessary reprocessing of the query.

Follow up to [54234].

Props david.binda, mukesh27, spacedmonkey.
Fixes #56721.

File:
1 edited

Legend:

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

    r54320 r54377  
    57885788    );
    57895789    $query = new WP_Query( $args );
    5790     $pages = $query->get_posts();
     5790    $pages = $query->posts;
    57915791
    57925792    if ( empty( $pages ) ) {
Note: See TracChangeset for help on using the changeset viewer.