diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index 2749b12..74341db 100644
|
|
|
class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { |
| 142 | 142 | $attachment->post_title = preg_replace( '/\.[^.]+$/', '', basename( $file ) ); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | | $id = wp_insert_post( $attachment, true ); |
| | 145 | $id = wp_insert_post( wp_slash( $attachment ), true ); |
| 146 | 146 | |
| 147 | 147 | if ( is_wp_error( $id ) ) { |
| 148 | 148 | if ( 'db_update_error' === $id->get_error_code() ) { |
| … |
… |
class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { |
| 369 | 369 | 'description' => __( 'The caption for the resource.' ), |
| 370 | 370 | 'type' => 'string', |
| 371 | 371 | 'context' => array( 'view', 'edit' ), |
| 372 | | 'arg_options' => array( |
| 373 | | 'sanitize_callback' => 'wp_filter_post_kses', |
| 374 | | ), |
| 375 | 372 | ); |
| 376 | 373 | |
| 377 | 374 | $schema['properties']['description'] = array( |
| 378 | 375 | 'description' => __( 'The description for the resource.' ), |
| 379 | 376 | 'type' => 'string', |
| 380 | 377 | 'context' => array( 'view', 'edit' ), |
| 381 | | 'arg_options' => array( |
| 382 | | 'sanitize_callback' => 'wp_filter_post_kses', |
| 383 | | ), |
| 384 | 378 | ); |
| 385 | 379 | |
| 386 | 380 | $schema['properties']['media_type'] = array( |
diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index e5d6237..c9b0907 100644
|
|
|
class WP_REST_Posts_Controller extends WP_REST_Controller { |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | $post->post_type = $this->post_type; |
| 486 | | $post_id = wp_insert_post( $post, true ); |
| | 486 | $post_id = wp_insert_post( wp_slash( $post ), true ); |
| 487 | 487 | |
| 488 | 488 | if ( is_wp_error( $post_id ) ) { |
| 489 | 489 | |
| … |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | // convert the post object to an array, otherwise wp_update_post will expect non-escaped input. |
| 622 | | $post_id = wp_update_post( (array) $post, true ); |
| | 622 | $post_id = wp_update_post( wp_slash( (array) $post ), true ); |
| 623 | 623 | |
| 624 | 624 | if ( is_wp_error( $post_id ) ) { |
| 625 | 625 | if ( 'db_update_error' === $post_id->get_error_code() ) { |
| … |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
| 955 | 955 | // Post title. |
| 956 | 956 | if ( ! empty( $schema['properties']['title'] ) && isset( $request['title'] ) ) { |
| 957 | 957 | if ( is_string( $request['title'] ) ) { |
| 958 | | $prepared_post->post_title = wp_filter_post_kses( $request['title'] ); |
| | 958 | $prepared_post->post_title = $request['title']; |
| 959 | 959 | } elseif ( ! empty( $request['title']['raw'] ) ) { |
| 960 | | $prepared_post->post_title = wp_filter_post_kses( $request['title']['raw'] ); |
| | 960 | $prepared_post->post_title = $request['title']['raw']; |
| 961 | 961 | } |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | // Post content. |
| 965 | 965 | if ( ! empty( $schema['properties']['content'] ) && isset( $request['content'] ) ) { |
| 966 | 966 | if ( is_string( $request['content'] ) ) { |
| 967 | | $prepared_post->post_content = wp_filter_post_kses( $request['content'] ); |
| | 967 | $prepared_post->post_content = $request['content']; |
| 968 | 968 | } elseif ( isset( $request['content']['raw'] ) ) { |
| 969 | | $prepared_post->post_content = wp_filter_post_kses( $request['content']['raw'] ); |
| | 969 | $prepared_post->post_content = $request['content']['raw']; |
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | // Post excerpt. |
| 974 | 974 | if ( ! empty( $schema['properties']['excerpt'] ) && isset( $request['excerpt'] ) ) { |
| 975 | 975 | if ( is_string( $request['excerpt'] ) ) { |
| 976 | | $prepared_post->post_excerpt = wp_filter_post_kses( $request['excerpt'] ); |
| | 976 | $prepared_post->post_excerpt = $request['excerpt']; |
| 977 | 977 | } elseif ( isset( $request['excerpt']['raw'] ) ) { |
| 978 | | $prepared_post->post_excerpt = wp_filter_post_kses( $request['excerpt']['raw'] ); |
| | 978 | $prepared_post->post_excerpt = $request['excerpt']['raw']; |
| 979 | 979 | } |
| 980 | 980 | } |
| 981 | 981 | |
diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
index ceaa26b..70422d4 100644
|
|
|
class WP_REST_Terms_Controller extends WP_REST_Controller { |
| 379 | 379 | |
| 380 | 380 | $prepared_term = $this->prepare_item_for_database( $request ); |
| 381 | 381 | |
| 382 | | $term = wp_insert_term( $prepared_term->name, $this->taxonomy, $prepared_term ); |
| | 382 | $term = wp_insert_term( $prepared_term->name, $this->taxonomy, wp_slash( $prepared_term ) ); |
| 383 | 383 | if ( is_wp_error( $term ) ) { |
| 384 | 384 | /* |
| 385 | 385 | * If we're going to inform the client that the term already exists, |
| … |
… |
class WP_REST_Terms_Controller extends WP_REST_Controller { |
| 490 | 490 | |
| 491 | 491 | // Only update the term if we haz something to update. |
| 492 | 492 | if ( ! empty( $prepared_term ) ) { |
| 493 | | $update = wp_update_term( $term->term_id, $term->taxonomy, (array) $prepared_term ); |
| | 493 | $update = wp_update_term( $term->term_id, $term->taxonomy, wp_slash( (array) $prepared_term ) ); |
| 494 | 494 | |
| 495 | 495 | if ( is_wp_error( $update ) ) { |
| 496 | 496 | return $update; |
| … |
… |
class WP_REST_Terms_Controller extends WP_REST_Controller { |
| 818 | 818 | 'type' => 'string', |
| 819 | 819 | 'context' => array( 'view', 'edit' ), |
| 820 | 820 | 'arg_options' => array( |
| 821 | | 'sanitize_callback' => 'wp_filter_post_kses', |
| | 821 | 'sanitize_callback' => 'wp_kses_post', |
| 822 | 822 | ), |
| 823 | 823 | ), |
| 824 | 824 | 'link' => array( |
diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
index 4576980..42f62aa 100644
|
|
|
class WP_REST_Users_Controller extends WP_REST_Controller { |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | $user->ID = $user_id; |
| 412 | | $user_id = wp_update_user( $user ); |
| | 412 | $user_id = wp_update_user( wp_slash( $user ) ); |
| 413 | 413 | |
| 414 | 414 | if ( is_wp_error( $user_id ) ) { |
| 415 | 415 | return $user_id; |
| 416 | 416 | } |
| 417 | 417 | } else { |
| 418 | | $user_id = wp_insert_user( $user ); |
| | 418 | $user_id = wp_insert_user( wp_slash( $user ) ); |
| 419 | 419 | |
| 420 | 420 | if ( is_wp_error( $user_id ) ) { |
| 421 | 421 | return $user_id; |
| … |
… |
class WP_REST_Users_Controller extends WP_REST_Controller { |
| 530 | 530 | // Ensure we're operating on the same user we already checked. |
| 531 | 531 | $user->ID = $id; |
| 532 | 532 | |
| 533 | | $user_id = wp_update_user( $user ); |
| | 533 | $user_id = wp_update_user( wp_slash( $user ) ); |
| 534 | 534 | |
| 535 | 535 | if ( is_wp_error( $user_id ) ) { |
| 536 | 536 | return $user_id; |
| … |
… |
class WP_REST_Users_Controller extends WP_REST_Controller { |
| 970 | 970 | 'type' => 'string', |
| 971 | 971 | 'context' => array( 'embed', 'view', 'edit' ), |
| 972 | 972 | 'arg_options' => array( |
| 973 | | 'sanitize_callback' => 'wp_filter_post_kses', |
| | 973 | 'sanitize_callback' => 'wp_kses_post', |
| 974 | 974 | ), |
| 975 | 975 | ), |
| 976 | 976 | 'link' => array( |