REST API: `unfiltered_html` and slashing: terms.
Follow-up to #38609 and #38704; handle slashes correctly for taxonomy terms. Props westonruter, jnylen0. Fixes #38726, see #38609. Built from https://develop.svn.wordpress.org/trunk@39190 git-svn-id: http://core.svn.wordpress.org/trunk@39130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7e11873b43
commit
e66d2478ee
|
@ -380,7 +380,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||||
|
|
||||||
$prepared_term = $this->prepare_item_for_database( $request );
|
$prepared_term = $this->prepare_item_for_database( $request );
|
||||||
|
|
||||||
$term = wp_insert_term( $prepared_term->name, $this->taxonomy, $prepared_term );
|
$term = wp_insert_term( addslashes( $prepared_term->name ), $this->taxonomy, wp_slash( (array) $prepared_term ) );
|
||||||
if ( is_wp_error( $term ) ) {
|
if ( is_wp_error( $term ) ) {
|
||||||
/*
|
/*
|
||||||
* If we're going to inform the client that the term already exists,
|
* If we're going to inform the client that the term already exists,
|
||||||
|
@ -491,7 +491,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||||
|
|
||||||
// Only update the term if we haz something to update.
|
// Only update the term if we haz something to update.
|
||||||
if ( ! empty( $prepared_term ) ) {
|
if ( ! empty( $prepared_term ) ) {
|
||||||
$update = wp_update_term( $term->term_id, $term->taxonomy, (array) $prepared_term );
|
$update = wp_update_term( $term->term_id, $term->taxonomy, wp_slash( (array) $prepared_term ) );
|
||||||
|
|
||||||
if ( is_wp_error( $update ) ) {
|
if ( is_wp_error( $update ) ) {
|
||||||
return $update;
|
return $update;
|
||||||
|
@ -821,9 +821,6 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||||
'description' => __( 'HTML description of the resource.' ),
|
'description' => __( 'HTML description of the resource.' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'context' => array( 'view', 'edit' ),
|
'context' => array( 'view', 'edit' ),
|
||||||
'arg_options' => array(
|
|
||||||
'sanitize_callback' => 'wp_filter_post_kses',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
'link' => array(
|
'link' => array(
|
||||||
'description' => __( 'URL to the resource.' ),
|
'description' => __( 'URL to the resource.' ),
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-beta2-39189';
|
$wp_version = '4.7-beta2-39190';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue