$post_args = array(
\'post_type\' => \'post\',
\'posts_per_page\' => -1,
\'meta_key\' => \'field_name\',
\'meta_value\' => \'field_value\',
);
$post_query = new WP_Query( $post_args );
$posts_array= array();
if ( $post_query->have_posts() ) {
while ( $post_query->have_posts() ) {
$post_query->the_post();
$posts_array[] = get_the_ID(); //Array of post ids
}
wp_reset_postdata();
}
//YOUR COMMENT ARGS SHOULD BE THIS
$args = array(
\'number\' => \'30\',
\'order\' => \'DESC\',
\'orderby\' => \'comment_date\',
\'post__in\' => $posts_array, //THIS IS THE ARRAY OF POST IDS WITH META QUERY
);
$comments_query = new WP_Comment_Query;
$comments = $comments_query->query( $args );
不要忘记通过元键和元值更新测试元键和测试元值。