how to find user ids of all commenters in a post
The get_comments() answer by Poulomi Nag is correct. This will be somewhat more efficient. global $wpdb, $post; $query = sprintf(“SELECT user_id FROM {$wpdb->comments} JOIN {$wpdb->posts} ON {$wpdb->posts}.ID = {$wpdb->comments}.comment_post_ID WHERE comment_post_ID = %d AND comment_approved = ‘1’”, $post->ID); $authors = $wpdb->get_col($query); $authors = array_unique($authors); $authors = array_diff($authors,array(‘0’)); // Remove those where users are not registered … Read more