Skip to content

Instantly share code, notes, and snippets.

@Dimasmagadan
Last active December 31, 2017 13:03
Show Gist options
  • Save Dimasmagadan/5879145 to your computer and use it in GitHub Desktop.
Save Dimasmagadan/5879145 to your computer and use it in GitHub Desktop.
#WordPress Comments Query
$args = array(
'author_email' => '',
'ID' => '',
'karma' => '',
'number' => '',
'offset' => '',
'orderby' => '',
'order' => 'DESC',
'parent' => '',
'post_ID' => '',
// 'post_id' => 0,
'post_author' => '',
'post_name' => '',
'post_parent' => '',
'post_status' => '',
'post_type' => '',
'status' => '',
'type' => '',
'user_id' => '',
'search' => '',
'count' => false,
'meta_key' => '',
'meta_value' => '',
'meta_query' => ''
);
$comments_query = new WP_Comment_Query;
$comments = $comments_query->query( $args );
// Comment Loop
if ( $comments ) {
foreach ( $comments as $comment ) {
echo $comment->comment_content;
}
} else {
// no comments
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment