1 使用官方函数

<?php 
    global $user_ID;
    echo get_comments('count=true&user_id='.$user_ID);
?>

2 使用sql查询数据库

function get_user_comments_count( $user_id ) {
    global $wpdb;
    $user_id = (int) $user_id;
    $sql     = "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id='$user_id' AND comment_approved = 1";
    $coo     = $wpdb->get_var( $sql );
    return ( $coo ) ? $coo-1: 0;
}