这不是虫子(喘息!)真的只是没有提供。要做到这一点,您必须添加一个过滤器,例如
add_filter( \'comments_clauses\', function ( $pieces, $query ) {
if ( empty( $query->query_vars[\'wpse_no_password\'] ) ) return $pieces;
global $wpdb;
$pieces[ \'where\' ] .= $wpdb->prepare( \' AND \' . $wpdb->posts . \'.post_password = %s\', \'\' );
return $pieces;
}, 10, 2 );
$args = array( \'post_status\' => \'publish\', \'wpse_no_password\' => 1 );
$query = new WP_Comment_Query( $args );