Sometime ago i deleted many non essential plugins to try and speed up my site and accidentally included Akismet.
I’m not sure how this happened but for some reason i received about 1000 spam comments that became automatically approved.
Some of my readers have pointed out that this isn’t a good look so i thought i’d work out how to remove them without having to remove all legitimate comments as well.
I did remove over 100 of them manually which took some time however i thought it better to find a solution which i could also write about and share on this blog.
WordPress doesn’t provide any feature within the core functions to delete comments by date so i’ve been running different MySql Database queries in PhpMyAdmin and worded out a solution.
Caution: Always create a database backup or export your database tables before running MySQL Database queries in PhpMyAdmin
A safe way to test these database queries is to import your database backup into a demo or test site and play around with it there. You can then export the database and import it into your primary installation.
Deleting Comments Using MySQL Database Queries in phpMyAdmin
Run the following query in phpMyAdmin after you change the dates to your own unique times.
DELETE FROM `wp_comments` WHERE `comment_date` BETWEEN '2010-03-25 00:00:00' AND '2012-03-28 00:00:00';
You’ll also need to run another query to clean up the meta data in wp_commentmeta
SELECT * FROM `wp_commentmeta` WHERE `comment_ID` NOT IN (SELECT `comment_ID` FROM `wp_comments`);
Deleting Comments Manually in phpMyAdmin
As you can see from the screenshot below, you can easily select rows of 30 comments at a time and delete comments that way.
![phpMyAdmin wp_comments phpMyAdmin wp_comments](https://wpsites.net/wp-content/uploads/2012/03/phpMyAdmin-wp_comments-660x76.png)
Couldn’t find a plugin to do this so maybe its an idea for someone who understands MySQL Database tables, PhpMyAdmin and has already created WordPress plugins.
If you know of an easier way to delete different types of WordPress comments by date, please share this information with us in the comments. Thanks.
Was This Tutorial Helpful?