Remove all WordPress comments before a specific date
You can remove all comments left before a specified date by deleting them in bulk in the WordPress database.
- Sign in to phpMyAdmin.
- In phpMyAdmin, on the left menu, select the name of the database your site uses.
- On the top menu, select SQL.
- In the box below, enter the following code:
DELETE from wp_comments WHERE comment_date <= 'YYYY-MM-DD HH:mm:ss'
- Replace YYYY with a year, MM with a month, DD with a day, HH with an hour, mm with a minute and ss with a second before which you want to remove comments. If you want to specify only the date, you can enter 00:00:00 for the time of day.
- (Optional) If your table prefix isn't wp_, replace wp_ before comments with your actual table prefix. You can check which prefix your site uses in the wp-config.php file.
- Select Go.
- When asked if you really want to execute the command, select OK.
All comments left before the chosen date are now removed from your site.