wp_is_comment_flood

Filters whether a comment is part of a comment flood.

Description

apply_filters( 'wp_is_comment_flood', (bool) $false, (string) $commentdata_comment_author_ip, (string) $commentdata_comment_author_email, (string) $commentdata_comment_date_gmt, (bool) $avoid_die ); 

The default check is wp_check_comment_flood(). See check_comment_flood_db().

Parameters (5)

0. $false (bool) => false
Is a comment flooding occurring? Default false.
1. $commentdata_comment_author_ip (string)
The commentdata comment author ip.
2. $commentdata_comment_author_email (string)
The commentdata comment author email.
3. $commentdata_comment_date_gmt (string)
The commentdata comment date gmt.
4. $avoid_die (bool)
Whether to prevent executing wp_die() or die() if a comment flood is occurring.

Usage

To run the hook, copy the example below.
  1. $false = apply_filters( 'wp_is_comment_flood', $false, $commentdata_comment_author_ip, $commentdata_comment_author_email, $commentdata_comment_date_gmt, $avoid_die ); 
  2.  
  3. if ( !empty( $false ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_is_comment_flood callback 
  2. function filter_wp_is_comment_flood( $false, $commentdata_comment_author_ip, $commentdata_comment_author_email, $commentdata_comment_date_gmt, $avoid_die ) { 
  3. // make filter magic happen here... 
  4. return $false
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_is_comment_flood', 'filter_wp_is_comment_flood', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_is_comment_flood', 'filter_wp_is_comment_flood', 10, 5 ); 

Defined (2)

The filter is defined in the following location(s).

/wp-includes/comment.php  
  1. $is_flood = apply_filters( 
  1. add_filter( 'wp_is_comment_flood', 'wp_check_comment_flood', 10, 5 );