Comments: Restore the fourth parameter of comments_number() as $post_id, for consistency with get_comments_number_text().

The parameter was previously used as the number of comments, marked as deprecated in [5101].

Given that it's been deprecated for the last 13 years, it should be safe to undeprecate and repurpose it for a cleaner function signature, instead of adding a fifth parameter.

Follow-up to [47276].

Fixes #48772.

git-svn-id: https://develop.svn.wordpress.org/trunk@47366 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-02-25 17:32:34 +00:00
parent 812773b8fc
commit a6b80a326a
2 changed files with 9 additions and 6 deletions

View File

@@ -40,6 +40,13 @@ class Tests_Comment_Template extends WP_UnitTestCase {
$comments_number_text = get_comments_number_text( false, false, false, $post_id );
$this->assertEquals( sprintf( _n( '%s Comment', '%s Comments', 6 ), '6' ), $comments_number_text );
ob_start();
comments_number( false, false, false, $post_id );
$comments_number_text = ob_get_clean();
$this->assertEquals( sprintf( _n( '%s Comment', '%s Comments', 6 ), '6' ), $comments_number_text );
}
/**