Title: comments_number
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘comments_number’, string $comments_number_text, int $comments_number )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#wp--skip-link--target)

Filters the comments count for display.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#see-also)󠁿

 * [_n()](https://developer.wordpress.org/reference/functions/_n/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#parameters)󠁿

 `$comments_number_text`string

A translatable string formatted based on whether the count is equal to 0, 1, or 
1+.

`$comments_number`int

The number of post comments.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'comments_number', $comments_number_text, $comments_number );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/comment-template.php#L1012)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment-template.php#L1012-L1012)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#related)󠁿

| Used by | Description | 
| [get_comments_number_text()](https://developer.wordpress.org/reference/functions/get_comments_number_text/)`wp-includes/comment-template.php` |

Displays the language string for the number of comments the current post has.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/comments_number/?output_format=md#comment-content-7092)
 2.   [Noruzzaman](https://profiles.wordpress.org/noruzzaman/)  [  2 years ago  ](https://developer.wordpress.org/reference/hooks/comments_number/#comment-7092)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomments_number%2F%23comment-7092)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomments_number%2F%23comment-7092)
 4. WordPress hooks provide a powerful way to modify and extend the core functionality
    of your site. The `apply_filters` function is used to apply filters to a variable,
    allowing you to modify data before it is used. The `comments_number` filter specifically
    allows you to alter the text that displays the number of comments before it is 
    shown on the site.
 5.     ```php
        function wpdocs_comments_number_filter( $comments_number_text, $comments_number ) {
            if ( 0 === $comments_number ) {
                $comments_number_text = __( 'No Comments Yet' );
            } elseif ( 1 === $comments_number ) {
                $comments_number_text = __( 'One Comment' );
            } else {
                $comments_number_text = $comments_number . ' ' . __( 'Awesome Comments' );
            }
    
            return $comments_number_text;
        }
    
        add_filter( 'comments_number', 'wpdocs_comments_number_filter', 10, 2 );
        ```
    
 6. By using `apply_filters` with the `comments_number` filter, you can easily customize
    the comments number text in WordPress. This technique allows you to tailor the 
    comments display to meet your specific needs.
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomments_number%2F%3Freplytocom%3D7092%23feedback-editor-7092)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomments_number%2F)
before being able to contribute a note or feedback.