Make WordPress Core


Ignore:
Timestamp:
11/08/2016 05:54:22 AM (7 years ago)
Author:
rmccue
Message:

REST API: Respect unfiltered_html for HTML post fields.

This necessitates a change to our slashing code as well. Ah slashing, the cause of, and solution to, all of life's problems.

Props jnylen0.
Fixes #38609.

File:
1 edited

Legend:

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

    r39154 r39155  
    143143        }
    144144
    145         $id = wp_insert_post( $attachment, true );
     145        $id = wp_insert_post( wp_slash( (array) $attachment ), true );
    146146
    147147        if ( is_wp_error( $id ) ) {
     
    251251        if ( isset( $request['caption'] ) ) {
    252252            if ( is_string( $request['caption'] ) ) {
    253                 $prepared_attachment->post_excerpt = wp_filter_post_kses( $request['caption'] );
     253                $prepared_attachment->post_excerpt = $request['caption'];
    254254            } elseif ( isset( $request['caption']['raw'] ) ) {
    255                 $prepared_attachment->post_excerpt = wp_filter_post_kses( $request['caption']['raw'] );
     255                $prepared_attachment->post_excerpt = $request['caption']['raw'];
    256256            }
    257257        }
     
    260260        if ( isset( $request['description'] ) ) {
    261261            if ( is_string( $request['description'] ) ) {
    262                 $prepared_attachment->post_content = wp_filter_post_kses( $request['description'] );
     262                $prepared_attachment->post_content = $request['description'];
    263263            } elseif ( isset( $request['description']['raw'] ) ) {
    264                 $prepared_attachment->post_content = wp_filter_post_kses( $request['description']['raw'] );
     264                $prepared_attachment->post_content = $request['description']['raw'];
    265265            }
    266266        }
Note: See TracChangeset for help on using the changeset viewer.