From 0eecbf8bafbffb720ff365d03490a2de2aada8e8 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sun, 20 Aug 2017 20:13:47 +0000 Subject: [PATCH] Docs: Clarify that `get_comments_number()` can return either a numeric string (for compatibility reasons) or 0 if the post doesn't exist. Also update the hook doc for the `get_comments_number` filter to reflect the mixed type for `$count`. Props kiranpotphode for the initial patch. Fixes #38369. Built from https://develop.svn.wordpress.org/trunk@41285 git-svn-id: http://core.svn.wordpress.org/trunk@41125 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 11 ++++++----- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index b9b4cae49d..e2bdaf60ce 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -830,12 +830,13 @@ function comments_link( $deprecated = '', $deprecated_2 = '' ) { } /** - * Retrieve the amount of comments a post has. + * Retrieves the amount of comments a post has. * * @since 1.5.0 * - * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. - * @return int The number of comments a post has. + * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`. + * @return string|int If the post exists, a numeric string representing the number of comments + * the post has, otherwise 0. */ function get_comments_number( $post_id = 0 ) { $post = get_post( $post_id ); @@ -852,8 +853,8 @@ function get_comments_number( $post_id = 0 ) { * * @since 1.5.0 * - * @param int $count Number of comments a post has. - * @param int $post_id Post ID. + * @param string|int $count A string representing the number of comments a post has, otherwise 0. + * @param int $post_id Post ID. */ return apply_filters( 'get_comments_number', $count, $post_id ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 0b7084cf68..2c9d2b6090 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41284'; +$wp_version = '4.9-alpha-41285'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.