//获取文章评论数,不包含作者自己 function get_comments_number_filter_author() { global $wpdb, $post; //需要过滤作者的名称 $author = '作者名称'; $comments = $wpdb->get_results("SELECT count(0) as total FROM $wpdb->comments WHERE comment_post_ID = $post->ID AND comment_type = '' AND comment_approved = '1' AND comment_author != '$author'"); return $comments[0]->total; }