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

---

# do_action( ‘check_comment_flood’, string $comment_author_ip, string $comment_author_email, string $comment_date_gmt, bool $wp_error )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/check_comment_flood/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/check_comment_flood/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/check_comment_flood/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/check_comment_flood/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/check_comment_flood/?output_format=md#changelog)

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

Fires immediately before a comment is marked approved.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/check_comment_flood/?output_format=md#description)󠁿

Allows checking for comment flooding.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/check_comment_flood/?output_format=md#parameters)󠁿

 `$comment_author_ip`string

Comment author’s IP address.

`$comment_author_email`string

Comment author’s email.

`$comment_date_gmt`string

GMT date the comment was posted.

`$wp_error`bool

Whether to return a [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
object instead of executing [wp_die()](https://developer.wordpress.org/reference/functions/wp_die/)
or die() if a comment flood is occurring.

More Arguments from wp_die( … $args )

Arguments to control behavior. If `$args` is an integer, then it is treated as the
response code.

 * `response` int
 * The HTTP response code. Default 200 for Ajax requests, 500 otherwise.
 * `link_url` string
 * A URL to include a link to. Only works in combination with $link_text.
 * `link_text` string
 * A label for the link to include. Only works in combination with $link_url.
 * `back_link` bool
 * Whether to include a link to go back. Default false.
 * `text_direction` string
 * The text direction. This is only useful internally, when WordPress is still loading
   and the site’s locale is not set up yet. Accepts `'rtl'` and `'ltr'`.
    Default
   is the value of [is_rtl()](https://developer.wordpress.org/reference/functions/is_rtl/).
 * `charset` string
 * Character set of the HTML output. Default `'utf-8'`.
 * `code` string
 * Error code to use. Default is `'wp_die'`, or the main error code if $message 
   is a [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/).
 * `exit` bool
 * Whether to exit the process after completion. Default true.

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

    ```php
    do_action(
    	'check_comment_flood',
    	$commentdata['comment_author_IP'],
    	$commentdata['comment_author_email'],
    	$commentdata['comment_date_gmt'],
    	$wp_error
    );
    ```

[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#L777)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/comment.php#L777-L783)

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

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

Validates whether this comment is allowed to be made.

  |

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

| Version | Description | 
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$avoid_die` parameter was renamed to `$wp_error`. | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | The `$avoid_die` parameter was added. | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## User Contributed Notes

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