get_comments_number() function giving wrong results because of a plugin filter. Which function can be used instead of get_comments_number() ?


$counts = wp_count_comments();

this will return total comments for blog

But if you want to get total comments of a post, then

$counts = wp_count_comments( $post_id );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.