Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to display, on the author/user/contributor page, the number of comments the user has posted, and the number of comments he has received on his posts. Is it possible?

Thank you !

share|improve this question

1 Answer 1

Got some idea from here. User's comments have posted

<?php
function commentCount() {
    global $wpdb;
    $count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb-comments. ' WHERE comment_author_email = "' . get_comment_author_email() . '"');
    echo $count . ' comments';
}

commentCount();
?>

I don't have any idea for comments that user got from their posts. Might be use custom $wpdb query too, where post_id is array of their post id.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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