Display the Total Number of Comments in WordPress Theme

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

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 [wpcc_total_comments] in your WordPress posts, pages, or text widget to display total number of comments on your site.