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

Glossary Term

get_comment_count()

3 tags 1 category

get_comment_count() — Retrieves the total comment counts for the whole site or a single post.

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 int[]: The number of comments keyed by their status. Field $approved (int): The number of approved comments. Field $awaiting_moderation (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…