1

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 !

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.

| improve this answer | |

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.