After we posted a tutorial on how to change automatic recycle bin deletion in WordPress, for anyone using Akismet, I think it would be a good idea to know how it works with Akismet. By default, Akismet keeps unwanted comments in your database. data WordPress for 15 days before deleting them. In this tutorial, we will show you how to change Akismet's spam removal schedule in WordPress.

akismet removal of unwanted comments

Why change the comment deletion frequency on Akismet?

This tutorial is for the Akismet plugin only. If you don't use it I show you how to use it In a tutorial. Akismet allows you to fight spam in comments. It monitors all comments, pingbacks, and trackbacks.

Spam comments remain in your database. data, which means that they increase the weight of the database backups data. Deleting them can reduce the size of your database.

While some users may believe that removing spam comments improves database performance, we do not think this has a major effect on database performance under most circumstances.

If you receive thousands of unwanted comments, and you try to delete them manually, then this may affect the performance of your site.

On the other hand, some users may want to keep spam comments for a longer period, so that they can review them later to perform a manual filter.

That said, let's see how you can change the schedule for removing unwanted comments on WordPress in Akismet.

How to change the schedule for removing unwanted comments on Akismet

Akismet automatically removes spam comments from your database after 15 days. This gives you time to manually review the comments.

If it marked a comment as spam, then you can mark it as "Desirable" or " Not spam". This is how Akismet learns and improves its algorithm to catch unwanted comments more effectively.

unwanted WordPress comment

You can change the number of Akismet days that spam comments will remain in the database. Just add the following code to your WordPress plugin.

add_filter ('akismet_delete_comment_interval', 'custom_spam_delete_interval'); function custom_spam_delete_interval () {return 7; }

Change « 7 With the number of days you want to keep a comment. This filter simply modifies Akismet's unwanted comments removal schedule.

Setting 0, will allow Akismet to delete all comments at the next life of a comment. It won't give you much time to review spam comments.

You can see your changes in the Akismet settings. Scroll to the bottom of the page, and you will see a note in lowercase letters saying after how many days the unwanted comments will be deleted.

Akismet settings

You have been warned! : When comments are deleted, they are not sent to trash. They are permanently deleted, so you will not be able to recover them.

That's it for this tutorial, I hope it gives you some control over how often Akismet comments are removed. Feel free to share it with your friends on your favorite social networks.