Fix an error caused by [28604] in `get_comments_number()` unit tests.

Props SergeyBiryukov.
Fixes #26240.



git-svn-id: https://develop.svn.wordpress.org/trunk@28638 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-05-30 19:46:05 +00:00
parent e996a74984
commit 3d48e21248
1 changed files with 3 additions and 2 deletions

View File

@ -684,10 +684,11 @@ function comments_link( $deprecated = '', $deprecated_2 = '' ) {
function get_comments_number( $post_id = 0 ) {
$post = get_post( $post_id );
if ( ! isset( $post->comment_count ) ) {
if ( ! $post ) {
$count = 0;
} else {
$count = $post->comment_count;
$post_id = $post->ID;
}
/**
@ -698,7 +699,7 @@ function get_comments_number( $post_id = 0 ) {
* @param int $count Number of comments a post has.
* @param int $post_id Post ID.
*/
return apply_filters( 'get_comments_number', $count, $post->ID );
return apply_filters( 'get_comments_number', $count, $post_id );
}
/**