Make WordPress Core


Ignore:
Timestamp:
11/08/2016 06:35:51 AM (9 years ago)
Author:
rmccue
Message:

REST API: Respect unfiltered_html for HTML comment fields.

Same as [39155], but for comments, natch.

Props jnylen0.
Fixes #38704, see #38609.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r39126 r39157  
    521521        $prepared_comment = apply_filters( 'rest_pre_insert_comment', $prepared_comment, $request );
    522522
    523         $comment_id = wp_insert_comment( $prepared_comment );
     523        $comment_id = wp_insert_comment( wp_filter_comment( wp_slash( (array) $prepared_comment ) ) );
    524524
    525525        if ( ! $comment_id ) {
     
    645645            }
    646646
    647             $updated = wp_update_comment( $prepared_args );
     647            $updated = wp_update_comment( wp_slash( (array) $prepared_args ) );
    648648
    649649            if ( 0 === $updated ) {
     
    996996         */
    997997        if ( isset( $request['content'] ) && is_string( $request['content'] ) ) {
    998             $prepared_comment['comment_content'] = wp_filter_kses( $request['content'] );
     998            $prepared_comment['comment_content'] = $request['content'];
    999999        } elseif ( isset( $request['content']['raw'] ) && is_string( $request['content']['raw'] ) ) {
    1000             $prepared_comment['comment_content'] = wp_filter_kses( $request['content']['raw'] );
     1000            $prepared_comment['comment_content'] = $request['content']['raw'];
    10011001        }
    10021002
Note: See TracChangeset for help on using the changeset viewer.