get_approved_comments
get_approved_comments ( $post_id, $args = array() )
Parameters:- (int) post_id The ID of the post.
- (array) args {
Optional. See WP_Comment_Query::__construct() for information on accepted arguments.
@type int $status Comment status to limit results by. Defaults to approved comments.
@type int $post_id Limit results to those affiliated with a given post ID.
@type string $order 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.
Defined at:Change Log: - Introduced in WordPress: 2.0.0
- Deprecated in WordPress: —
Description
Retrieves the approved comments for a post.