apply_filters( ‘comment_flood_filter’, bool $bool, int $time_lastcomment, int $time_newcomment )

Filters the comment flood status.

Parameters

$boolbool
Whether a comment flood is occurring. Default false.
$time_lastcommentint
Timestamp of when the last comment was posted.
$time_newcommentint
Timestamp of when the new comment was posted.

Source

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

Changelog

VersionDescription
2.1.0Introduced.

User Contributed Notes

  1. Skip to note 3 content

    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.