From 26592196e0fc10c8fd676bbd49335c380a876271 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 11 Aug 2019 12:41:34 +0000 Subject: [PATCH] Docs: Improve documentation for `get_page_by_title()`. Props atachibana. Fixes #47860. git-svn-id: https://develop.svn.wordpress.org/trunk@45779 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index ae688a3470..7636c3d02b 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -4881,11 +4881,19 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) { /** * Retrieve 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. + * + * Because this function uses the MySQL '=' comparison, $page_title will usually be matched + * as case-insensitive with default collation. + * * @since 2.1.0 + * @since 3.0.0 The `$post_type` parameter was added. * * @global wpdb $wpdb WordPress database abstraction object. * - * @param string $page_title Page title + * @param string $page_title Page title. * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to * a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT. * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.