0

I need to ignore counting author replies within comments number function, for example If I have 9 replies (comments) which 4 of them appertain to post author, I would display 5 comments as comments number in my post.

Do you know any method to do it?

Thanks in advance.

1 Answer 1

2

You can use these inside the loop, or in comments.php

//The author of current post
$author_ID = get_the_author_meta("ID");
//The current post ID
$p_ID = get_the_ID();
//Number of guest comments
echo count(get_comments(array(
                'post_id' => $p_ID,
                'author__not_in' => array($author_ID)
            )));

More: https://codex.wordpress.org/Function_Reference/get_comments

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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