Is there a function in wordpress that grabs all the users(user ids) who have commented on a post? I have the post id available.
Leave a Reply
You must be logged in to post a comment.
Is there a function in wordpress that grabs all the users(user ids) who have commented on a post? I have the post id available.
You must be logged in to post a comment.
The get_comments() answer by Poulomi Nag is correct. This will be somewhat more efficient.
Another alternative is to use WP_Comment_Query
http://core.trac.wordpress.org/browser/branches/3.2/wp-includes/comment.php#L186
The following snippet is one way of doing it:
The user IDs of course should be used for better use than just
echo
ing.