check_comment_flood
Action HookDescription
Fires immediately before a comment is marked approved. Allows checking for comment flooding.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Action |
Line Number | 768 |
Hook Parameters
Type | Name | Description |
---|---|---|
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 check_comment_flood
add_action('check_comment_flood', 'my_custom_function', 10, 4);
function my_custom_function($comment_author_ip, $comment_author_email, $comment_date_gmt, $wp_error) {
// Your custom code here
}
Source Code Context
wp-includes/comment.php:768
- How this hook is used in WordPress core
<?php
763 * @param string $comment_author_email Comment author's email.
764 * @param string $comment_date_gmt GMT date the comment was posted.
765 * @param bool $wp_error Whether to return a WP_Error object instead of executing
766 * wp_die() or die() if a comment flood is occurring.
767 */
768 do_action(
769 'check_comment_flood',
770 $commentdata['comment_author_IP'],
771 $commentdata['comment_author_email'],
772 $commentdata['comment_date_gmt'],
773 $wp_error
PHP Documentation
<?php
/**
* Fires immediately before a comment is marked approved.
*
* Allows checking for comment flooding.
*
* @since 2.3.0
* @since 4.7.0 The `$avoid_die` parameter was added.
* @since 5.5.0 The `$avoid_die` parameter was renamed to `$wp_error`.
*
* @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: Action
- Parameters: 4
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.