Skip to content

Instantly share code, notes, and snippets.

@willcritchlow
Created October 20, 2011 14:07
Show Gist options
  • Save willcritchlow/1301218 to your computer and use it in GitHub Desktop.
Save willcritchlow/1301218 to your computer and use it in GitHub Desktop.
SQL for getting WordPress commenters' email addresses
select a.comment_author_email, max(a.comment_date) as date, b.comment_author from wp_comments a, wp_comments b where a.comment_author_email = b.comment_author_email and a.comment_date = b.comment_date and a.comment_approved=1 and a.comment_author_email <> "" and a.user_id = 0 and a.comment_author_email not like '%YOUREMAILDOMAIN%' group by a.comment_author_email;
@willcritchlow
Copy link
Author

If you are running mysql on the command line and you save this file as wp-commenters.sql you can output to a tab-separated file with:
mysql -u root -p db_name < wp-commenters.sql > wp-commenters.tsv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment