How to Display the Total Number of Comments in WordPress

Do you want to show total number of comments on your WordPress site? Comments allow users to participate and engage with content on your WordPress site. By showing off your total comment count, you can encourage more users to join the conversation. In this article, we will show you how to easily display total number of comments in WordPress.

Method 1. Display WordPress Comment Count with a Plugin

This method is easier and is recommended for all users.

First thing you need to do is install and activate the Simple Blog Stats plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » Simple Blog Stats page to configure plugin settings.

Simple Blog Stats settings

The plugin allows you to show your blog stats using shortcodes and template tags.

On this page you will see all the shortcodes that you can use to show different stats like total number of comments, registered users, categories, tags, and much more.

You need to copy the shortcode [sbs_approved] to display the total number of approved comments on your WordPress site.

You can use this shortcode in any WordPress post, page, or text widget. If the shortcode does not work in the text widget, then please see our guide on how to use shortcode in WordPress sidebar widgets.

Method 2. Display WordPress Comment Count with Code

This method requires you to add code to your WordPress files. If you haven’t done this before, then please check out our guide on how to copy paste code in WordPress.

First, you will need to add this code to your theme’s functions.php file or a site-specific plugin.

    function wpb_comment_count() {     $comments_count = wp_count_comments();  $message =  'There are <strong>'.  $comments_count->approved . '</strong> comments posted by our users.';    return $message;     }     add_shortcode('wpb_total_comments','wpb_comment_count');   add_filter('widget_text','do_shortcode');   

This code simply creates a function that outputs total number of approved WordPress comments on your site. It then creates a shortcode to display it. You can customize the output message as needed.

Next, you can use the shortcode [wpb_total_comments] in your WordPress posts, pages, or text widget to display total number of comments on your site.

This is how it looked on our demo site.

Preview of comment numbers