Make WordPress Core

Ticket #57105: comment_validation.patch

File comment_validation.patch, 970 bytes (added by apermo, 3 years ago)

Patch for wp_handle_comment_submission to enrich it with a custom validation.

  • wp-includes/comment.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/wp-includes/comment.php b/wp-includes/comment.php
    a b  
    36213621                'user_id'
    36223622        );
    36233623
     3624        /**
     3625         * Allows a custom validation.
     3626         *
     3627         * @since TBD
     3628         *
     3629         * @param null|WP_Error $custom_validation Your possible custom error.
     3630         * @param array         $commentdata       Array of comment data to be sent to wp_insert_comment().
     3631         * @param array         $comment_data      The raw comment data from the function call.
     3632         */
     3633        $custom_validation = apply_filters( 'comment_form_fields_validation', null, $commentdata, $comment_data );
     3634        if ( is_wp_error( $custom_validation ) ) {
     3635                return $custom_validation;
     3636        }
     3637
    36243638        /**
    36253639         * Filters whether an empty comment should be allowed.
    36263640         *