Family Encyclopedia >> Electronics

How to Customize Akismet Spam Comment Deletion Schedule in WordPress

After sharing our guide on tweaking WordPress's garbage collection schedule, a reader asked about adjusting Akismet's spam comment retention. By default, Akismet stores spam comments in your database for 15 days before automatic deletion. As experienced WordPress administrators, we'll show you how to customize this in a few simple steps.

How to Customize Akismet Spam Comment Deletion Schedule in WordPress

Why Adjust Akismet's Spam Deletion in WordPress?

This tutorial applies specifically to the Akismet plugin. If you're not using it, read our in-depth guide on why Akismet is essential for WordPress spam protection.

Akismet effectively combats comment spam, monitoring comments, pingbacks, and trackbacks across your site.

Spam accumulates in your database, bloating backups and storage. Deleting it sooner helps maintain a leaner database.

While some claim early deletion boosts performance, our tests on high-traffic sites show minimal impact in most cases.

Manually purging thousands of spam comments can temporarily slow your site—see our guide on batch deleting spam comments for efficient alternatives.

Conversely, extending retention allows reviewing spam to catch false positives and refine your setup.

Ready to customize? Here's how to modify Akismet's spam deletion schedule using proven code we've deployed on production sites.

Customizing Akismet's Spam Comment Deletion Interval

Akismet holds spam for 15 days by default, giving ample time for manual review and training its algorithms.

If you accidentally flag a legit comment as spam, simply unspam it—Akismet learns from these actions to improve accuracy over time.

How to Customize Akismet Spam Comment Deletion Schedule in WordPress

To change the retention period, add this code snippet to your theme's functions.php file or a custom site plugin:

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

Replace 7 with your desired days. This filter overrides Akismet's default schedule safely.

Setting it to 0 triggers immediate deletion on the next cycle—use cautiously, as it limits review time.

Verify your changes on Settings » Akismet. Scroll to the bottom for the updated note: "Spam in the spam folder older than 7 days is automatically deleted."

How to Customize Akismet Spam Comment Deletion Schedule in WordPress

The number reflects your custom value.

Important: Deleted spam bypasses the trash—permanent removal, no recovery.

This tweak has helped us optimize countless WordPress sites. For more protection, check our guide on blocking spam bots with honeypot techniques.

Subscribe to our WordPress YouTube channel for video tutorials, and follow us on Twitter and Facebook for tips.