Spam gathers in my WordPress comments by the thousands every day. It can get quite overwhelming to manage. Especially when attempting to delete the tens of thousands of comments Akismet marked as “Spam” at once. If you attempt to delete too many comments at once from the WordPress Dashboard, it will likely error out or even worse, crash your site.

Fortunately, there is an easier way to delete Spam comments. You can do this easily using a database SQL command. Most hosts use phpMyAdmin to manage databases, so I will use that as an example on how to do this.

  1. Login to PHPMyAdmin and select the database you wish to work with.
  2. Select the “SQL” tab.
  3. Type one of the following depending on what you wish to accomplish:
    • To delete all comments marked as Spam, type:
      DELETE FROM wp_comments WHERE comment_approved = ‘spam’;
    • To delete all comments┬ánot approved, type:
      DELETE FROM wp_comments WHERE comment_approved = ‘0’;
  4. Select the “Go” button, and let it do its thing. All the comments should be removed in less than a second.

Published by Mitch Bartlett

I've been doing things on the Internet since 1994. Former dot-com era IT guy. Currently I provide technical solutions to people for fun and test software for a growing software company.

Leave a comment

Your email address will not be published. Required fields are marked *