count number of user comments with a specific comment meta value
Your basic question is a pure SQL question. $count = $wpdb->get_var( ‘SELECT COUNT( comments.comment_ID ) FROM ‘. $wpdb->comments .’ as comments LEFT JOIN ‘.$wpdb->commentmeta.’ AS cmeta ON comments.comment_ID = cmeta.comment_id WHERE user_id = 1 AND comment_approved = “1” AND comment_type NOT IN (“pingback”, “trackback” ) AND cmeta.meta_key = “rating” AND cmeta.meta_value = 5′ ); I … Read more