From 9d69e005ea58e531268fdf8258d9230070f9d8b1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 17 Dec 2019 20:24:46 +0000 Subject: [PATCH] Docs: Clarify that `get_lastpostdate()` and `get_lastpostmodified()` can return `false` on failure. The both use `_get_last_post_time()` internally. Props Rarst. See #48957. git-svn-id: https://develop.svn.wordpress.org/trunk@46973 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 6ffd960c72..1fd84bc2c5 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -6392,7 +6392,7 @@ function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, * 'gmt' uses the `post_date_gmt` field. * Default 'server'. * @param string $post_type Optional. The post type to check. Default 'any'. - * @return string The date of the last post. + * @return string The date of the last post, or false on failure. */ function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) { /** @@ -6400,9 +6400,9 @@ function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) { * * @since 2.3.0 * - * @param string $date Date the last post was published. - * @param string $timezone Location to use for getting the post published date. - * See get_lastpostdate() for accepted `$timezone` values. + * @param string|false $date Date the last post was published. False on failure. + * @param string $timezone Location to use for getting the post published date. + * See get_lastpostdate() for accepted `$timezone` values. */ return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date', $post_type ), $timezone ); } @@ -6421,7 +6421,7 @@ function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) { * for information on accepted values. * Default 'server'. * @param string $post_type Optional. The post type to check. Default 'any'. - * @return string The timestamp in 'Y-m-d H:i:s' format. + * @return string The timestamp in 'Y-m-d H:i:s' format, or false on failure. */ function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) { /** @@ -6452,9 +6452,10 @@ function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) { * * @since 2.3.0 * - * @param string $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format. - * @param string $timezone Location to use for getting the post modified date. - * See get_lastpostdate() for accepted `$timezone` values. + * @param string|false $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format. + * False on failure. + * @param string $timezone Location to use for getting the post modified date. + * See get_lastpostdate() for accepted `$timezone` values. */ return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone ); } @@ -6472,7 +6473,7 @@ function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) { * for information on accepted values. * @param string $field Post field to check. Accepts 'date' or 'modified'. * @param string $post_type Optional. The post type to check. Default 'any'. - * @return string|false The timestamp in 'Y-m-d H:i:s' format, or false on error. + * @return string|false The timestamp in 'Y-m-d H:i:s' format, or false on failure. */ function _get_last_post_time( $timezone, $field, $post_type = 'any' ) { global $wpdb;