WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way or a plugin so that I can see statistics for may comments and commenters? Like top commenters, most commented post, etc.

Thanks, Alex

share|improve this question

For most commented posts you can use a custom loop in the sidebar for example:

<h3>Most Commented Posts</h3>

<?php $most_commented = new WP_Query('orderby=comment_count&posts_per_page=5');

if($most_commented->have_posts()) : ?>

<ul class="most-commented-posts">

<?php while($most_commented->have_posts()) : $most_commented->the_post(); ?>    

    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?> (<?php comments_number('0','1','%'); ?>)</a></li>

<?php endwhile; ?>

</ul><!-- most-commented-posts -->

<?php endif; wp_reset_query(); ?>

For the top commenters you can use something like this:

Top Commenters: exclude admin

And for comment stats like total comments, etc. use this function:

function comment_stats() {
    global $wpdb;

    // approved responses (comments and trackbacks) 
    $comment_stats['total_responses'] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");

    // trackback count
    $comment_stats['total_trackbacks'] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_type = 'pingback' OR comment_type = 'trackback'");

    // comments count
    $comment_stats['total_comments'] = $comment_stats['total_responses'] - $comment_stats['total_trackbacks'];

   // Akismet spam captured
   if(function_exists('akismet_count')) {

              $comment_stats['spam_blocked'] = akismet_count();


  if(!empty($comment_stats)) {

  $html .= "<ul class=\"comments-stats\">\n";

  foreach($comment_stats as $stat => $stat_value) :

       if(isset($stat_value) && $stat_value > 0) {

             $stat_name = str_replace("_", " ", $stat);

                           $html .= "<li>" .ucwords($stat_name). " : " .number_format($stat_value). "</li>\n";



  $html .= "</ul>\n";

  echo $html;


share|improve this answer

I use Admin comments statistics plugin ( http://www.greatwpplugins.com/admin-comments-statistics/ ). I can see statistics for my post comments and users. Also I can see statistics for the blog admins, so I can see my activity on my blog. I recommend.



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.