WordPress has builtin function wp_count_comments to count total comments for a given post id or all comments. The function will return totals of moderated, approved, spam, trash, post-trashed and total_comments. But we can't use the function for special case like if we want to result total comments for single and multiple category or tag. We should build our own database queries to get the results. Below are code snippets collection to get the total post or site comments and some special cases.
The post WordPress Get Total Comment Count appeared first on CodeCheese.