Pending Comments

How get ID all pending comments wp ? I want realizate via loop php, but i do not how get it.wp_get_comment_status - func

How get ID all pending comments wp ? I want realizate via loop php, but i do not how get it.

wp_get_comment_status - function is returend only trash', 'approved', 'unapproved', 'spam' status.

How get ID all pending comments wp ? I want realizate via loop php, but i do not how get it.

wp_get_comment_status - function is returend only trash', 'approved', 'unapproved', 'spam' status.

Share Improve this question edited Mar 21, 2019 at 0:02 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Mar 20, 2019 at 14:20 gomezgomez 32 bronze badges 1
  • 1 I'd guess 'unapproved' are the pending ones. Can you find a comment in pending then check its status in the database? – Rup Commented Mar 20, 2019 at 14:42
Add a comment  | 

1 Answer 1

Reset to default 1

get_comments() will get comments for you, either from all across a blog or for a specific post. Its arguments are documented at WP_Comment_Query::__construct().

Unless you've installed a plugin that adds pending as a comment status, you're probably looking for something like this:

$args = array(
     // Limits comments to a specific post.
     // Leave this off if you want all comments, blog-wide.
    'post_id' => $post_id,
    // Get only non-approved (ie, pending) comments.
    'status'  => 'hold',
    // Will only fetch comment IDs.
    // If you want full comment objects, leave this off.
    'fields'  => 'ids',
);
$comments = get_comments( $args );

If you have installed a plugin that adds pending as a status, you can try using 'status' => 'pending' instead of 'status' => 'hold', since the status argument will allow custom statuses.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745670564a4639378.html

相关推荐

  • Pending Comments

    How get ID all pending comments wp ? I want realizate via loop php, but i do not how get it.wp_get_comment_status - func

    21天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信