From f0e3ab49b3dc29f34016a2bf3168c44a0a5055bd Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 9 Feb 2021 13:42:58 +0000 Subject: [PATCH] Posts, Post Types: Clarify the documentation about the return value of `get_post()` when a falsey value is passed. Props Rahe, juliobox, peterwilsoncc, hellofromTonya, audrasjb Fixes #33068 git-svn-id: https://develop.svn.wordpress.org/trunk@50266 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index b280bde627..526d8f7f36 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -751,7 +751,9 @@ function get_extended( $post ) { * * @global WP_Post $post Global post object. * - * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. + * @param int|WP_Post|null $post Optional. Post ID or post object. `null`, `false`, `0` and other PHP falsey + * values return the current global post inside the loop. A numerically valid post + * ID that points to a non-existent post returns `null`. Defaults to global $post. * @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.