No spam

Delete spam comments after three (3) days

Here is how to change Akismet interval to three days instead of 15 days for deleting spam comments using the akismet_delete_comment_interval filter.

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:

add_filter( 'akismet_delete_comment_interval', 'custom_delete_spam_interval' );
function custom_delete_spam_interval() {
  return 3;
}Code language: PHP (php)

This changes Akismet’s 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:

Akismet: Spam in the spam folder older than 3 days is deleted automatically

Protip: Donate $10, 20 or 30 through Paypal (or see my donate page) and support this site. Thank you <3

Jan Reilink

Hi, my name is Jan. I am not a hacker, coder, developer or guru. I am merely an application manager / systems administrator, doing my daily thing at Embrace - The Human Cloud. In the past I worked for clidn and Vevida. With over 20 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, websites & optimization. I blog at

Oldest Most Voted
Inline Feedbacks
View all comments
01/04/2020 16:33


I tried this on my blog but it didn’t work. Can we say that this code is not working anymore? I guess this doesn’t work in WordPress 5 and above versions. Would you check?

Reply to  Hakan Kara
22/04/2020 10:03

Hello Hakan,
I’ve Tested This Code Today On The Latest Verison Of WordPress AND Its Working!
I Even Changed 3 Days to Only 1.