check_comment_flood action-hookWP 2.3.0

Fires immediately before a comment is marked approved.

Allows checking for comment flooding.

Usage

add_action( 'check_comment_flood', 'wp_kama_check_comment_flood_action', 10, 4 );

/**
 * Function for `check_comment_flood` action-hook.
 * 
 * @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 void
 */
function wp_kama_check_comment_flood_action( $comment_author_ip, $comment_author_email, $comment_date_gmt, $wp_error ){

	// action...
}
$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 2.3.0 Introduced.
Since 4.7.0 The $avoid_die parameter was added.
Since 5.5.0 The $avoid_die parameter was renamed to $wp_error.

Where the hook is called

wp_allow_comment()
check_comment_flood
wp-includes/comment.php 735-741
do_action(
	'check_comment_flood',
	$commentdata['comment_author_IP'],
	$commentdata['comment_author_email'],
	$commentdata['comment_date_gmt'],
	$wp_error
);

Where the hook is used in WordPress

wp-includes/default-filters.php 299
add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );