We create beautiful & user-friendly websites and provide quality web development services worldwide.
Contact us to get started on your project.


How to Quickly Clear Thousands of WordPress Spam Comments

Published by Veron Ang | 1


When you run a WordPress site, it’s inevitable that spam comments will find their way into your blog. Plugins like Akismet do a good job at weeding out the spam, separating them from the normal comments.

If you login to WordPress to find that your site has accumulated thousands of spam comments, the first thing you may think of doing is to hit that “Empty Spam” button. This is useful for clearing spam when the number is smaller. When you have thousands of spam, clicking this button can take a long time, and even cause a timeout on the server.

There’s a far quicker way to clear the spam, via this simple SQL command in phpMyAdmin:

DELETE FROM wp_comments WHERE comment_approved = "spam";
DELETE FROM wp_commentmeta WHERE meta_key LIKE "akismet_%";

And voila! The spam gets cleared out in seconds.

After manually clearing the spam in the database, you may also notice an overhead in the wp_comment and wp_commentmeta tables. You can optimise these 2 tables like this:

OPTIMIZE TABLE wp_comments;
OPTIMIZE TABLE wp_commentmeta;

About the Author

Veron Ang is a , developer and WordPress expert at Sparklette Studio. She has been building websites for as long as she can remember, and graduated with a bachelor's degree in computer science from the National University of Singapore.

1 comment

  • Thank you!
    I had thousands of spam comments and got timeouts every time I used the “Empty spam” button – this worked perfectly.

Leave a comment