Display the Most Accurate Comment Count in WordPress

How to Display the Most Accurate Comment Count in WordPress

Do you want to Display the Most Accurate Comment Count in WordPress?

Showing the comments count of each user can encourage them to post more comments. Let’s take a look at how to display comment count for each user.

So we will show you How to Display the Most Accurate Comment Count in WordPress

You can display the most accurate comment count in WordPress using this ways

Display the Most Accurate Comment Count in WordPress using Admin Commenters Comments Count

By default in WordPress, it is not possible to tell via a single glance whether a particular commenter has commented before or how many times the’ve commented.

Admin Commenters Comments count plugin adds this handy capability to the WordPress admin pages that allows

Quickly identify a first-time commenter, identify unfamiliar commenters that have in fact commented before, see how many total comments a particular commenter has made, and how many comments are pending and navigate to a listing of all approved comments and all moderated comments by a commenter, in order to see what post and when they last commented.

Commenters are identified by the email address they provided when commenting. If your site does not require that commenters submit their email address when commenting, this plugin will use the commenter’s name as the identifier, though since this is a publicly viewable piece of data it’s possible that multiple people could be posting under the same “name”, so this method has the potential to be not as accurate.

Display the Most Accurate Comment Count in WordPress using WordPress code editor

When you are displaying comment count it is always good to display the accurate comment count. WordPress by default includes your trackbacks and pings into the total count which actually inflates the count. Specially some blogs that does not show trackbacks, or has them separated from the comments, you need to make sure that you are displaying the right count.

Open your functions.php which is located in your template folder. And Paste the following code in there:

add_filter('get_comments_number', 'comment_count', 0);
function comment_count( $count ) {
if ( ! is_admin() ) {
global $id;
$comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
return count($comments_by_type['comment']);
} else {
return $count;
}
} 

With this snippet, you can now show the most accurate comment count to your blog users.

If you have any issue on this, you can use our comment session or join our delegate on facebook to solve any issues related to WordPress and subscribe to our YouTube Channel for WordPress video tutorials.

Share this Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top