WPDev.one
Core Function
View Source on Trac ↗

get_approved_comments()

get_approved_comments( mixed $post_id, mixed $args = array() )

Retrieves the approved comments for a post.

Parameters 2 required

Name / Type Description
$post_id
int

The ID of the post.

Required
array

$args { Optional. See WP_Comment_Query::__construct() for information on accepted arguments.

Required

Return Value

((WP_Comment[])
(WP_Comment[] | int[] | int) The approved comments, or number of comments if `$count` argument is true.

Function Information

Since Version
2.0.0
Source File
wp-includes/comment.php
Advertisement