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
749           false,
750           $commentdata['comment_author_IP'],
751           $commentdata['comment_author_email'],
752           $commentdata['comment_date_gmt'],
753           $avoid_die
754      );
755
756      if ( $is_flood ) {
757           /** This filter is documented in wp-includes/comment-template.php */
758           $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) );
759
760           return new WP_Error( 'comment_flood', $comment_flood_message, 429 );
761      }
762
763      if ( ! empty( $commentdata['user_id'] ) ) {
764           $user        = get_userdata( $commentdata['user_id'] );
765           $post_author = $wpdb->get_var(
766                $wpdb->prepare(
767                     "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1",
 
Line Code
906                     return true;
907                } else {
908                     /**
909                      * Filters the comment flood error message.
910                      *
911                      * @since 5.2.0
912                      *
913                      * @param string $comment_flood_message Comment flood error message.
914                      */
915                     $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) );
916
917                     if ( wp_doing_ajax() ) {
918                          die( $comment_flood_message );
919                     }
920
921                     wp_die( $comment_flood_message, 429 );
922                }
923           }
924      }