WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/25/2020 05:32:34 PM (19 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/template.php

    r47276 r47366  
    4141
    4242        $this->assertEquals( sprintf( _n( '%s Comment', '%s Comments', 6 ), '6' ), $comments_number_text );
     43
     44        ob_start();
     45        comments_number( false, false, false, $post_id );
     46        $comments_number_text = ob_get_clean();
     47
     48        $this->assertEquals( sprintf( _n( '%s Comment', '%s Comments', 6 ), '6' ), $comments_number_text );
     49
    4350    }
    4451
Note: See TracChangeset for help on using the changeset viewer.