Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

wp_count_comments()

3 tags 1 category

wp_count_comments() — Retrieves the total comment counts for the whole site or a single post. The comment stats are cached and then retrieved, if they already exist in the cache.

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

Returns stdClass: The number of comments keyed by their status. Field $approved (int): The number of approved comments. Field $moderated (int): The number of comments awaiting moderation (a.k.a. pending). Field $spam (int): The number of spam comments. Field $trash (int): The number of trashed comments. Field $post-trashed (int): The number of comments for posts that are in the trash. Field $total_comments (int): The total number of non-trashed comments, including spam. Field $all (int): The total number of pending or approved comments.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…