Is there a way to get comments with more than one status using get_comments function?

Let's say I would like to get both trash and hold comments.

It is possible to do the same with posts:

get_posts(array('post_status' => 'draft,private,trash'));
get_posts(array('post_status' => array('draft', 'private', 'trash')));

What I want to do is:

get_comments(array('status' => 'hold,trash'));
get_comments(array('status' => array('hold', 'trash')));

2 Answers 2


As of the Wordpress codex there is no such option. But you could just combine two or more comment arrays using plain PHP:

    get_comments( array( 'status' => 'hold' ) ),
    get_comments( array( 'status' => 'trash' ) )



  • 1
    Make sure both parts are actually arrays. The function can return NULL in some cases, array_merge() will trigger an error then.
    – fuxia
    Dec 27, 2012 at 17:42
  • Yeah, I know PHP quite well :) Dec 27, 2012 at 17:54
  • Works nicely for approved and unapproved comments. The merge even supports correct threading for unapproved comments.
    – Radek
    Oct 15, 2013 at 22:20

Not possible. You have to filter comments_clauses:

add_filter( 'comments_clauses', 'wpse_77415_comment_clauses_filter' );

function wpse_77415_comment_clauses_filter( $clauses )
    $clauses['where'] .= " ( comment_approved = 'hold' OR comment_approved = 'trash' )";
    // maybe remove the original 'comment_approved' statement …

    return $clauses;

More examples:

  • Seems you know WordPress better than @feeela, but his method is more simple and more convenient. Thanks, for the code, anyway, maybe I will use it in the future. +1 Dec 27, 2012 at 17:33
  • "Not possible." Well, you provided a solution that made it possible…
    – feeela
    Dec 27, 2012 at 19:05
  • It's not possible do do it just like that, you need to filter the sql clause. Dec 27, 2012 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.