wp_is_comment_flood filter-hookWP 4.7.0

Filters whether a comment is part of a comment flood.

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

Usage

add_filter( 'wp_is_comment_flood', 'wp_kama_is_comment_flood_filter', 10, 5 );

/**
 * Function for `wp_is_comment_flood` filter-hook.
 * 
 * @param bool   $is_flood             Is a comment flooding occurring? Default false.
 * @param string $comment_author_IP    Comment author's IP address.
 * @param string $comment_author_email Comment author's email.
 * @param string $comment_date_gmt     GMT date the comment was posted.
 * @param bool   $wp_error             Whether to return a WP_Error object instead of executing wp_die() or die() if a comment flood is occurring.
 *
 * @return bool
 */
function wp_kama_is_comment_flood_filter( $is_flood, $comment_author_IP, $comment_author_email, $comment_date_gmt, $wp_error ){

	// filter...
	return $is_flood;
}
$is_flood(true|false)
Is a comment flooding occurring? Default false.
$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(true|false)
Whether to return a WP_Error object instead of executing wp_die() or die() if a comment flood is occurring.

Changelog

Since 4.7.0 Introduced.
Since 5.5.0 The $avoid_die parameter was renamed to $wp_error.

Where the hook is called

wp_allow_comment()
wp_is_comment_flood
wp-includes/comment.php 758-765
$is_flood = apply_filters(
	'wp_is_comment_flood',
	false,
	$commentdata['comment_author_IP'],
	$commentdata['comment_author_email'],
	$commentdata['comment_date_gmt'],
	$wp_error
);

Where the hook is used in WordPress

wp-includes/comment.php 840
add_filter( 'wp_is_comment_flood', 'wp_check_comment_flood', 10, 5 );