When you're displaying the comment count, it's always good to display the exact comment count. WordPress by default includes your trackbacks and pings in the total count which actually inflates the count. Especially on some blogs that don't display trackbacks, or have them separated from comments, you need to make sure you're displaying the correct number. In this article, we'll show you how you can display the correct comment count via a small snippet that will filter out trackbacks and pings and only display the actual comment count to your users.
Open your functions.php located in your templates folder. And paste the following code 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)); recuento de devoluciones ($ comments_by_type ['comment']); else return $ count;
With this snippet, you can now display the most accurate comment count for your blog users.