From 022aea0d2ad03e427bbb7852322f1e1722208ecd Mon Sep 17 00:00:00 2001 From: Patrick Coombe Date: Wed, 3 Jun 2026 13:14:42 -0400 Subject: [PATCH] Docs: Clarify return value of get_page_by_title() for duplicate titles. The DocBlock made two contradictory claims (smallest ID vs. oldest publication date). The underlying query has no ORDER BY, so the row returned for duplicate titles is implementation-dependent. Props pbiron. Fixes #53495. --- src/wp-includes/deprecated.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 14f5c24aec914..9982c60dbc9af 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -4550,9 +4550,8 @@ function _filter_query_attachment_filenames( $clauses ) { /** * Retrieves a page given its title. * - * If more than one post uses the same title, the post with the smallest ID will be returned. - * Be careful: in case of more than one post having the same title, it will check the oldest - * publication date, not the smallest ID. + * If more than one post uses the same title, which one is returned is not deterministic, + * as the query used to find the post does not specify an order. * * Because this function uses the MySQL '=' comparison, $page_title will usually be matched * as case-insensitive with default collation.