wp_count_comments ( $post_id = 0 )

  • (int) $post_id Optional. Post ID.
  • (object|array) Comment stats.
Defined at:


Retrieve total comments for blog or single post.

The properties of the returned object contain the 'moderated', 'approved', and spam comments for either the entire blog or single post. Those properties contain the amount of comments that match the status. The 'total_comments' property contains the integer of total comments.

The comment stats are cached and then retrieved, if they already exist in the cache.

Related Functions

wp_count_attachments, wp_untrash_comment, wp_list_comments, wp_new_comment, wp_count_posts

Top Google Results

User discussions

wpseek mobile