将此放在您的函数中。php主题文件:
<?php
function ps_count_user_comments() {
global $wpdb;
$count = $wpdb->get_var(
\'SELECT COUNT(comment_ID) FROM \' . $wpdb->comments. \'
WHERE comment_author_email = "\' . get_comment_author_email() . \'"
AND comment_approved = "1"
AND comment_type IN ("comment", "")\'
);
return $count . \' comments\';
}
?>
此代码将计算作者注释,不包括trackback/pingback。
然后按如下方式打印:
<?php echo ps_count_user_comments(); ?>
您可以尝试在SQL中运行此命令并更改
[email protected]发送到您的邮件。我假设您的数据库前缀是wp\\u0,但如果不是,请更改
wp_comments
到您的前缀。
SELECT COUNT(comment_ID) FROM wp_comments
WHERE comment_author_email = "[email protected]"
AND comment_approved = "1"
AND comment_type IN ("comment", "")