# Stricter Comment Flood Protection

> Requires a longer pause between two comments from the same person, 60 seconds instead of WordPress's 15, to slow down comment bursts.

- Type: PHP
- Runs: Run everywhere
- Category: [Comments](https://wpide.com/library/category/comments/)
- Tags: comments, spam, rate-limit
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/stricter-comment-flood-protection/

## Code

```php
// Seconds that must pass between two comments from the same IP or email.
$wpide_comment_flood_seconds = 60;

add_filter( 'comment_flood_filter', function ( $is_flood, $time_last, $time_new ) use ( $wpide_comment_flood_seconds ) {
    if ( $is_flood || current_user_can( 'moderate_comments' ) ) {
        return $is_flood;
    }

    return ( $time_new - $time_last ) < $wpide_comment_flood_seconds;
}, 20, 3 );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Stricter Comment Flood Protection" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
