Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: allow_empty_comment

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

Line Code
3371
3372      /**
3373       * Filters whether an empty comment should be allowed.
3374       *
3375       * @since 5.1.0
3376       *
3377       * @param bool  $allow_empty_comment Whether to allow empty comments. Default false.
3378       * @param array $commentdata         Array of comment data to be sent to wp_insert_comment().
3379       */
3380      $allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
3381      if ( '' === $comment_content && ! $allow_empty_comment ) {
3382           return new WP_Error( 'require_valid_comment', __( '<strong>Error</strong>: Please type a comment.' ), 200 );
3383      }
3384
3385      $check_max_lengths = wp_check_comment_data_max_lengths( $commentdata );
3386      if ( is_wp_error( $check_max_lengths ) ) {
3387           return $check_max_lengths;
3388      }
3389