Retrieve WordPress Comments with Multiple Statuses Using WP_Comment_Query
You can use the 'status' parameter in the WP_Comment_Query to fetch comments with multiple statuses. Here's an example code to get comments with 'approved' and 'spam' statuses:
$args = array(
'status' => array('approved', 'spam')
);
$comments_query = new WP_Comment_Query;
$comments = $comments_query->query( $args );
This will return an array of WP_Comment objects with either 'approved' or 'spam' status. You can replace the 'approved' and 'spam' with any other comment status you want to fetch.
原文地址: https://www.cveoy.top/t/topic/owdb 著作权归作者所有。请勿转载和采集!