allow_empty_comment

allow_empty_comment

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.7.2

apply_filters('allow_empty_comment') is found 3 times:

  • /wp-includes/class-wp-xmlrpc-server.php line 4007
    4004
    4005
    4006
    4007
    4008
    4009
    4010
    4011
    4012
    4013
    $comment['comment_parent'] = isset( $content_struct['comment_parent'] ) ? absint( $content_struct['comment_parent'] ) : 0;
     
    /** This filter is documented in wp-includes/comment.php */
    $allow_empty = apply_filters( 'allow_empty_comment', false, $comment );
     
    if ( ! $allow_empty && '' === $comment['comment_content'] ) {
        return new IXR_Error( 403, __( 'Comment is required.' ) );
    }
     
    /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
  • /wp-includes/comment.php line 3690
    3686
    3687
    3688
    3689
    3690
    3691
    3692
    3693
    3694
    3695
    3696
    *
     * @param bool  $allow_empty_comment Whether to allow empty comments. Default false.
     * @param array $commentdata         Array of comment data to be sent to wp_insert_comment().
     */
    $allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
    if ( '' === $comment_content && ! $allow_empty_comment ) {
        return new WP_Error( 'require_valid_comment', __( '<strong>Error:</strong> Please type your comment text.' ), 200 );
    }
     
    $check_max_lengths = wp_check_comment_data_max_lengths( $commentdata );
    if ( is_wp_error( $check_max_lengths ) ) {
  • /wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php line 1903
    1899
    1900
    1901
    1902
    1903
    1904
    1905
    1906
    1907
    1908
    1909
        )
    );
     
    /** This filter is documented in wp-includes/comment.php */
    $allow_empty = apply_filters( 'allow_empty_comment', false, $check );
     
    if ( $allow_empty ) {
        return true;
    }
     
    /*