Created
June 28, 2011 14:35
-
-
Save wildiney/1051261 to your computer and use it in GitHub Desktop.
WordPress - Count comments by author
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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