wp_count_comments


wp_count_comments ( $post_id = 0 )

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

Description

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_count_posts, wp_new_comment

Top Google Results

User discussions

wpseek mobile