How to clean up WordPress comments

February 22nd, 2009

Although I posted almost every day I was traveling, I spent no time cleaning up spam comments, so the unreviewed comments built up to over 3000 entries. There’s no mass delete function in the WordPress interface, so I used phpMyAdmin to delete them manually with this SQL:

DELETE FROM wp_comments WHERE comment_approved != 1

[Update: I just updgraded to WordPress 2.7.1 and it allows bulk deletes. It doesn't allow you to invert selection flags, though, so if there are some comments you want to keep without publishing, the following SQL is still useful:

DELETE FROM wp_comments WHERE comment_approved != 1 and comment_author_email not in ('friend1@example.com', 'friend2@example.com')

]

Leave a Reply