check_comment_flood
Fires immediately before a comment is marked approved.
Allows checking for comment flooding.
Использование
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(строка)
- Comment author's IP address.
- $comment_author_email(строка)
- Comment author's email.
- $comment_date_gmt(строка)
- 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.
Список изменений
С версии 2.3.0 | Введена. |
С версии 4.7.0 | The $avoid_die parameter was added. |
С версии 5.5.0 | The $avoid_die parameter was renamed to $wp_error. |
Где вызывается хук
check_comment_flood
wp-includes/comment.php 768-774
do_action( 'check_comment_flood', $commentdata['comment_author_IP'], $commentdata['comment_author_email'], $commentdata['comment_date_gmt'], $wp_error );
Где используется хук в WordPress
wp-includes/default-filters.php 309
add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );