Display total number of 💬 comments in WordPress

Display total number of 💬 comments in WordPress

Add the following code to your active theme’s functions.php file and then add this shortcode [wpm_total_comments] anywhere on your website where you want the total number of comments to display.

/** *Display total number of WordPress comments*/
function wpm_comment_count() { 
$comments_count = wp_count_comments();
$message =  'There are '.  $comments_count->approved . ' comments posted by our visitors.';
return $message; 
} 
add_shortcode('wpm_total_comments','wpm_comment_count');
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.