WordPress Help

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.

Warning: Always make a backup of your site before making any changes to the database.
  1. Sign in to phpMyAdmin.
  2. In phpMyAdmin, on the left menu, select the name of the database your site uses.
    select a database in phpMyAdmin
  3. On the top menu, select SQL.
    SQL tab in phpMyAdmin
  4. In the box below, enter the following code:
    DELETE from wp_comments WHERE comment_date <= 'YYYY-MM-DD HH:mm:ss'
  5. 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.
  6. (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.
  7. Select Go.
  8. When asked if you really want to execute the command, select OK.
    prompt in the wordpress database

All comments left before the chosen date are now removed from your site.

More info

Share this article