WordPress at Your Fingertips

comments_number() WP 1.0

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

1 time — 0.000071 sec (very fast) | 50000 times — 1.61 sec (fast)

No Hooks.

Return

null. Nothing.

Usage

comments_number( $zero, $one, $more, $post_id );
$zero(string|false)
Text for no comments.
Default: false
$one(string|false)
Text for one comment.
Default: false
$more(string|false)
Text for more than one comment.
Default: false
$post_id(int|WP_Post)
Post ID or WP_Post object.
Default: global $post

Changelog

Since 0.71 Introduced.
Since 5.4.0 The $deprecated parameter was changed to $post_id.

Code of comments_number() WP 5.8

<?php
function comments_number( $zero = false, $one = false, $more = false, $post_id = 0 ) {
	echo get_comments_number_text( $zero, $one, $more, $post_id );
}

From category: Comments Loop

More from Template Tags: Comments

No comments
    Log In