mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Posts, Post Types: Fix WP_Query
parameter used by get_page_by_title()
.
Fixes the call to `WP_Query` within `get_page_by_title()` by using the correct title parameter, `title`. Modify the `orderby` parameter to prioritize the oldest published date over the smallest post ID. This ensures the behaviour matches that of the previous version of `get_page_by_title()`. The tests have been modified to include a populated post table to ensure the posts returned are matched by design rather than coincidence. Follow up to [54234]. Props dd32, timothyblynjacobs, peterwilsoncc. Fixes #56609. See #36905. Built from https://develop.svn.wordpress.org/trunk@54271 git-svn-id: http://core.svn.wordpress.org/trunk@53830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a0cefe8a20
commit
2d21751903
@ -5775,14 +5775,14 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
|
||||
*/
|
||||
function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
|
||||
$args = array(
|
||||
'post_title' => $page_title,
|
||||
'title' => $page_title,
|
||||
'post_type' => $post_type,
|
||||
'post_status' => get_post_stati(),
|
||||
'posts_per_page' => 1,
|
||||
'update_post_term_cache' => false,
|
||||
'update_post_meta_cache' => false,
|
||||
'no_found_rows' => true,
|
||||
'orderby' => 'ID',
|
||||
'orderby' => 'post_date ID',
|
||||
'order' => 'ASC',
|
||||
);
|
||||
$query = new WP_Query( $args );
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-54270';
|
||||
$wp_version = '6.1-alpha-54271';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user