apply_filters( 'comment_flood_filter', bool $bool, int $time_lastcomment, int $time_newcomment )

Filters the comment flood status.


Parameters

$bool bool
Whether a comment flood is occurring. Default false.
$time_lastcomment int
Timestamp of when the last comment was posted.
$time_newcomment int
Timestamp of when the new comment was posted.

Top ↑

Source

File: wp-includes/comment.php. View all references

$flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment );


Top ↑

Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 2 content
    Contributed by gggshine999

    The default time required between multiple comments from the same user/IP is 15 seconds. If the user posts the second comment faster than 15 seconds after the first comment, the comment flood message is triggered.
    Below is an example showing how to change the default time.
    Source: https://wordpress.org/support/article/faq-working-with-wordpress/#how-do-i-prevent-comment-flooding

    function wpdocs_dam_the_flood( $dam_it, $time_last, $time_new ) {
        if ( ( $time_new - $time_last ) < 300 ) { // time interval is 300 seconds
            return true;
        }
    
        return false;
    }
    add_filter( 'comment_flood_filter', 'wpdocs_dam_the_flood', 10, 3 );

You must log in before being able to contribute a note or feedback.