Normally in WordPress, Akismet deletes spam comments after 15 days, which may be fine with you or not. If you'd like to change the interval in which Akismet deletes spam comments, you can add the following code to your functions.php
file:
/**
* Filter to change Akismet interval to delete spam comments after 3 days
* Support/Donate: https://www.paypal.me/jreilink
*/
add_filter( 'akismet_delete_comment_interval', 'custom_delete_spam_interval' );
function custom_delete_spam_interval() {
return 3;
}
This changes Akismet interval to 3 days, after which comments held as spam are automatically deleted. You need to select Always put spam in the Spam folder for review option, as shown below:
- How to disable WordPress comments
- Clean-up WordPress spam comments and meta data
- Clean up WordPress post revisions
In this post you learned how to change Akismet interval to three (3) days instead of 15 days for deleting spam comments, using the akismet_delete_comment_interval()
filter in your WordPress functions.php file.