Delete Old WordPress Comments Automatically

There are a few reasons why you might need to automatically delete comments based on date. For maintenance or even performance.

A while back me and my friend Pedro Carvalho where working a project that needed this feature for legal reasons. We developed a plugin and decided to release it in the WordPress plugin repository with the permission of the project managers.

Delete Old Comments is very simple, non intrusive plugin. It will provide you a few options to automate the task of deleting comments based on age. They can either be sent to trash or permanently deleted.

The plugin will offer you 3 simple settings:

  • Recurrence – How often to check for old comments
  • Age – Set how old they need to be to exclude them
  • Operation Type – set if the operation will trash the old comments or permanently delete them.
settings page for plugin
Plugin Settings.

The new settings will be added to the ‘Discussion’ settings page.

We hope this simple plugin is helpful if someone else needs to implement this feature.

Feel free to leave feedback or ask any question either in the comments section below or on the plugin page.

Posted by Carlos Moreira

Web developer based in Porto, Portugal, working mostly with WordPress. Disclosure: Some of the links in this blog are 'affiliate links.' This means if you click on a link to a commercial product and purchase the item, I will receive an affiliate commission.

4 Replies to “Delete Old WordPress Comments Automatically”

  1. Hi, amazing plugin. I wonder if its possible to select 1 month or 3 mont. Right now the least one is just 6 month 🙂


    1. Hi! You can edit the file lib/Core.php and edit this line:
      '6 months ago' => esc_html__( '6 months', 'delete-old-comments' ),
      You can edit the line or add more lines like this. There’s no planned updates for the plugin and if there will be, we’ll include this change, so it’s safe to make the change.
      Hope it helps
      Greetings, Carlos


      1. Hi , I edited the file lib/Core.php : ‘3 hours ago’ => esc_html__(‘3 hours’, ‘delete-old-comments’ ), how can I configure comments to be deleted more than once a day , next clean up operation will run every 3 hours ?


        1. Hi! You can use to add more cron intervals, so you can add Cron Schedule for 10800 seconds. It will then display in the ‘delete old comments’ settings also.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.