# Keep Akismet Spam Longer Before Deleting

> Changes how long Akismet keeps caught spam before deleting it (15 days by default), giving you more time to rescue legitimate comments marked as spam.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: akismet, spam, comments
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/akismet-keep-spam-longer/

## Code

```php
$wpide_days = 30; // Days to keep spam.

add_filter( 'akismet_delete_comment_interval', function () use ( $wpide_days ) {
    return max( 1, (int) $wpide_days );
} );
```

## Notes

Set $wpide_days; use a lower number to clean up sooner on very busy sites.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Keep Akismet Spam Longer Before Deleting" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
