WPDev.one
Core Function
View Source on Trac ↗

wp_count_comments()

wp_count_comments( mixed $post_id = 0 )

Retrieves the total comment counts for the whole site or a single post.

Parameters 1 required

Name / Type Description
int

$post_id Optional. Restrict the comment counts to the given post. Default 0, which indicates that comment counts for the whole site will be retrieved.

Required

Return Value

(stdClass)
stdClass { The number of comments keyed by their status.

Function Information

Since Version
2.5.0
Source File
wp-includes/comment.php
Advertisement