Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: comment_flood_message

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
786           false,
787           $commentdata['comment_author_IP'],
788           $commentdata['comment_author_email'],
789           $commentdata['comment_date_gmt'],
790           $wp_error
791      );
792
793      if ( $is_flood ) {
794           /** This filter is documented in wp-includes/comment-template.php */
795           $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) );
796
797           return new WP_Error( 'comment_flood', $comment_flood_message, 429 );
798      }
799
800      if ( ! empty( $commentdata['user_id'] ) ) {
801           $user        = get_userdata( $commentdata['user_id'] );
802           $post_author = $wpdb->get_var(
803                $wpdb->prepare(
804                     "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1",
 
Line Code
947                     return true;
948                } else {
949                     /**
950                      * Filters the comment flood error message.
951                      *
952                      * @since 5.2.0
953                      *
954                      * @param string $comment_flood_message Comment flood error message.
955                      */
956                     $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) );
957
958                     if ( wp_doing_ajax() ) {
959                          die( $comment_flood_message );
960                     }
961
962                     wp_die( $comment_flood_message, 429 );
963                }
964           }
965      }