Skip to content

Instantly share code, notes, and snippets.

@wildiney
Created June 28, 2011 14:35
Show Gist options
  • Save wildiney/1051261 to your computer and use it in GitHub Desktop.
Save wildiney/1051261 to your computer and use it in GitHub Desktop.
WordPress - Count comments by author
<?php
function commentCount() {
global $wpdb;
$count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. ' WHERE comment_author_email = "' . get_comment_author_email() . '"');
return $count . ' comments';
}
/* USAGE */
/*
<?php echo commentCount(); ?>
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment