Title: comment_flood_filter
Published: April 25, 2014
Last modified: May 20, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#wp--skip-link--target)

Filters the comment flood status.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#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.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/comment.php#L896)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/comment.php#L896-L896)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_check_comment_flood()](https://developer.wordpress.org/reference/functions/wp_check_comment_flood/)`wp-includes/comment.php` |

Checks whether comment flooding is occurring.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#comment-content-5953)
 2.    [gggshine999](https://profiles.wordpress.org/gggshine999/)  [  4 years ago  ](https://developer.wordpress.org/reference/hooks/comment_flood_filter/#comment-5953)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_flood_filter%2F%23comment-5953)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_flood_filter%2F%23comment-5953)
 4.  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](https://wordpress.org/support/article/faq-working-with-wordpress/#how-do-i-prevent-comment-flooding)
 5.      ```php
         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 );
         ```
     
 6.   * Great note, thanks. The original reference link no longer works, I can’t seem
        to find it if it still exists.
      * [Marty](https://profiles.wordpress.org/bozzmedia/) [3 years ago](https://developer.wordpress.org/reference/hooks/comment_flood_filter/#comment-6626)
 7.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_flood_filter%2F%3Freplytocom%3D5953%23feedback-editor-5953)
 8.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/comment_flood_filter/?output_format=md#comment-content-4912)
 9.    [busirocket](https://profiles.wordpress.org/busirocket/)  [  5 years ago  ](https://developer.wordpress.org/reference/hooks/comment_flood_filter/#comment-4912)
 10. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_flood_filter%2F%23comment-4912)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_flood_filter%2F%23comment-4912)
 11. If you want to disable this function, enter the following code in the function.
     php file of your theme:
 12.     ```php
         add_filter( 'comment_flood_filter', '__return_false' );
         ```
     
 13.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_flood_filter%2F%3Freplytocom%3D4912%23feedback-editor-4912)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_flood_filter%2F)
before being able to contribute a note or feedback.