### [如何按评论数量显示前100名评论者](https://www.prosaas.cn/article/9345) **Published:** 2019-12-14T06:19:11 **Author:** 5201314 **Excerpt:** 下面由WordPress建站教程栏目给大家介绍按评论数量显示前100名评论者的方法,希望对需要的朋友有所帮助!… 下面由**WordPress建站****教程**栏目给大家介绍按评论数量显示前100名评论者的方法,希望对需要的朋友有所帮助!  如想看看自己博客上哪位博友的留言评论最多及最后的评论时间,下面一段代码会帮你实现这个功能。 可以将下面代码添加到当前主题functions.php中: function top\_comment\_authors($amount = 100) { global $wpdb; $prepared\_statement = $wpdb->prepare( 'SELECT COUNT(comment\_author) AS comments\_count, comment\_author, comment\_author\_url, MAX( comment\_date ) as last\_commented\_date FROM '.$wpdb->comments.' WHERE comment\_author != "" AND comment\_type = "" AND comment\_approved = 1 GROUP BY comment\_author ORDER BY comments\_count DESC, comment\_author ASC LIMIT %d', $amount); $results = $wpdb->get\_results($prepared\_statement); $output = '