Filter hook 'wp_is_comment_flood'

in WP Core File wp-includes/comment.php at line 791

View Source

wp_is_comment_flood

Filter Hook
Description
Filters whether a comment is part of a comment flood. The default check is wp_check_comment_flood(). See check_comment_flood_db().

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Filter
Line Number 791

Hook Parameters

Type Name Description
bool $is_flood Is a comment flooding occurring? Default false.
string $comment_author_ip Comment author's IP address.
string $comment_author_email Comment author's email.
string $comment_date_gmt GMT date the comment was posted.
bool $wp_error Whether to return a WP_Error object instead of executing wp_die() or die() if a comment flood is occurring.

Usage Examples

Basic Usage
<?php
// Hook into wp_is_comment_flood
add_filter('wp_is_comment_flood', 'my_custom_filter', 10, 5);

function my_custom_filter($is_flood, $comment_author_ip, $comment_author_email, $comment_date_gmt, $wp_error) {
    // Your custom filtering logic here
    return $is_flood;
}

Source Code Context

wp-includes/comment.php:791 - How this hook is used in WordPress core
<?php
 786  	 * @param string $comment_author_email Comment author's email.
 787  	 * @param string $comment_date_gmt     GMT date the comment was posted.
 788  	 * @param bool   $wp_error             Whether to return a WP_Error object instead of executing
 789  	 *                                     wp_die() or die() if a comment flood is occurring.
 790  	 */
 791  	$is_flood = apply_filters(
 792  		'wp_is_comment_flood',
 793  		false,
 794  		$commentdata['comment_author_IP'],
 795  		$commentdata['comment_author_email'],
 796  		$commentdata['comment_date_gmt'],

PHP Documentation

<?php
/**
	 * Filters whether a comment is part of a comment flood.
	 *
	 * The default check is wp_check_comment_flood(). See check_comment_flood_db().
	 *
	 * @since 4.7.0
	 * @since 5.5.0 The `$avoid_die` parameter was renamed to `$wp_error`.
	 *
	 * @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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 5
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.