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

Glossary Term

get_approved_comments()

3 tags 1 category

get_approved_comments() — Retrieves the approved comments for a post.

Inputs: $post_id (int): The ID of the post. $args (array): Optional. See WP_Comment_Query::__construct() for information on accepted arguments. Field $status (int): Comment status to limit results by. Defaults to approved comments. Field $post_id (int): Limit results to those affiliated with a given post ID. Field $order (string): How to order retrieved comments. Default ‘ASC’.

Returns WP_Comment[]|int[]|int: The approved comments, or number of comments if $count argument is true. An empty array is returned when $post_id is falsey, even when $count is true.

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…