From 336517fab3dc5e050b263bd7abcef7210f7cac44 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 4 Oct 2022 03:33:10 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@54377 git-svn-id: http://core.svn.wordpress.org/trunk@53936 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 44f00898ab..b4e9f755d7 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -5787,7 +5787,7 @@ function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) 'order' => 'ASC', ); $query = new WP_Query( $args ); - $pages = $query->get_posts(); + $pages = $query->posts; if ( empty( $pages ) ) { return null; diff --git a/wp-includes/version.php b/wp-includes/version.php index 7010f6ac89..8e3973026d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-beta2-54376'; +$wp_version = '6.1-beta2-54377'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.