• Resolved ZewaLogi

    (@amazinghulk)


    Hi,

    Is it possible to change the interval when spam is automatically deleted? As far as I am aware by default is 15. By that time too much spam occurs on my site. I want to reduce the time to 5 days.

    Also, is it possible to set that all comments marked as spam are instantly deleted?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Christopher Finke

    (@cfinke)

    To reduce the time to 5 days, you’d have to write a small plugin to add this filter:

    
    function reduce_akismet_auto_delete_time( $days ) {
        return 5;
    }
    
    add_filter( 'akismet_delete_comment_interval', 'reduce_akismet_auto_delete_time' );
    

    There’s not a way to instantly delete comments marked as spam, but you could modify the function above to return 0 instead of 5 to have comments deleted every day from spam.

    Thread Starter ZewaLogi

    (@amazinghulk)

    What do you exactly mean by that I would need to write a small plugin to add that filter?

    Plugin Author Christopher Finke

    (@cfinke)

    If you put this code in a file called reduce-akismet-auto-delete-time.php in wp-content/mu-plugins/, it should have the effect you’re looking for:

    
    <?php
    
    function reduce_akismet_auto_delete_time( $days ) {
        return 5;
    }
    
    add_filter( 'akismet_delete_comment_interval', 'reduce_akismet_auto_delete_time' );
    

    For more information on writing plugins, see https://www.wpexplorer.com/writing-simple-wordpress-plugin/

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Change when spam is removed’ is closed to new replies.