Un motore di ricerca WordPress per sviluppatori e autori di temi



get_approved_comments ›

Da2.0.0
Deprecaton/a
get_approved_comments ( $post_id, $args = array() )
Parametri: (2)
  • (int) $post_id The ID of the post.
    Richiesto:
  • (array) $args Optional. See WP_Comment_Query::__construct() for information on accepted arguments.
    Richiesto: No
    Default: array()
Ritorna:
  • (int|array) $comments The approved comments, or number of comments if `$count` argument is true.
Definito a:
Codex:
ChangeLog:
  • 4.1.0

Retrieve the approved comments for post $post_id.



Sorgenti

function get_approved_comments( $post_id, $args = array() ) {
	if ( ! $post_id ) {
		return array();
	}

	$defaults = array(
		'status'  => 1,
		'post_id' => $post_id,
		'order'   => 'ASC',
	);
	$r = wp_parse_args( $args, $defaults );

	$query = new WP_Comment_Query;
	return $query->query( $r );
}