You might wonder is it possible to change the delete schedule for spam comments in Akismet. keeps spam comments in your database for 15 days before deleting them. This article will show you do that.

Why Change How Akismet Deletes Spam in WordPress?

The will only apply if you are using Akismet plugin. Akismet allows you to combat comment spam in WordPress. It monitors all comments, pingbacks and trackbacks. What spam comments do is that they reside in your database which will eventually increase the size of your . Deleting them will cut down the size.

Some users may believe that deleting spam comments improves database performance, we don’t think it has a major effect on database performance in most circumstances.

If you are receiving thousands of spam comments, and you try to delete them manually, then it could affect your site’s performance. Some users may want to keep spam comments for a longer period, so that they can review them later to avoid false positives.

Changing Spam Comment Delete Schedule in WordPress with Akismet

If it marked a genuine comment as spam, then you can mark it as not spam. This is how Akismet learns and improves it’s algorithms to catch spam comments more efficiently.


You can change the number of days Akismet should keep spam comments in your database. Simply add this code to your theme’s functions.php file or in a site-specific plugin.

1add_filter( ‘akismet_delete_comment_interval’,’custom_spam_delete_interval’ );




3function custom_spam_delete_interval() {


4    return 7;




Change 7 with the number of days you want to keep a comment. This filter simply modifies Akismet’s spam deletion schedule.

Changing the number to 0, will allow Akismet to delete all comments on its next comment delete schedule. This will not give you much time to review spam comments.

You can see your changes in action by visiting Settings » Akismet page. Scroll down to the bottom of the page, and you will see a note in tiny letters saying ‘Spam in the spam folder older than 7 days is deleted automatically.’


It will replace 7 days with the number of days you used in your filter.


Tags : wordpressWordPress how to
Nooruddin Ahmed

The author Nooruddin Ahmed

An avid football fan. Lives for the weekend game.Aviation enthusiast. Believes in letting bygones be bygones.

Leave a Response