diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
index bde6bdd430..7eaf541091 100644
a
|
b
|
function remove_option_whitelist( $del_options, $options = '' ) { |
4101 | 4101 | |
4102 | 4102 | return remove_allowed_options( $del_options, $options ); |
4103 | 4103 | } |
| 4104 | |
| 4105 | /** |
| 4106 | * Adds slashes to only string values in an array of values. |
| 4107 | * |
| 4108 | * This should be used when preparing data for core APIs that expect slashed data. |
| 4109 | * This should not be used to escape data going directly into an SQL query. |
| 4110 | * |
| 4111 | * @since 5.3.0 |
| 4112 | * @deprecated 5.6.0 |
| 4113 | * |
| 4114 | * @see wp_slash() |
| 4115 | * |
| 4116 | * @param mixed $value Scalar or array of scalars. |
| 4117 | * @return mixed Slashes $value |
| 4118 | */ |
| 4119 | function wp_slash_strings_only( $value ) { |
| 4120 | return map_deep( $value, 'addslashes_strings_only' ); |
| 4121 | } |
| 4122 | |
| 4123 | /** |
| 4124 | * Adds slashes only if the provided value is a string. |
| 4125 | * |
| 4126 | * @since 5.3.0 |
| 4127 | * @deprecated 5.6.0 |
| 4128 | * |
| 4129 | * @see wp_slash() |
| 4130 | * |
| 4131 | * @param mixed $value |
| 4132 | * @return mixed |
| 4133 | */ |
| 4134 | function addslashes_strings_only( $value ) { |
| 4135 | return is_string( $value ) ? addslashes( $value ) : $value; |
| 4136 | } |
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index 45922d6f65..b842d21497 100644
a
|
b
|
function wp_unslash( $value ) { |
5545 | 5545 | return stripslashes_deep( $value ); |
5546 | 5546 | } |
5547 | 5547 | |
5548 | | /** |
5549 | | * Adds slashes to only string values in an array of values. |
5550 | | * |
5551 | | * This should be used when preparing data for core APIs that expect slashed data. |
5552 | | * This should not be used to escape data going directly into an SQL query. |
5553 | | * |
5554 | | * @since 5.3.0 |
5555 | | * |
5556 | | * @param mixed $value Scalar or array of scalars. |
5557 | | * @return mixed Slashes $value |
5558 | | */ |
5559 | | function wp_slash_strings_only( $value ) { |
5560 | | return map_deep( $value, 'addslashes_strings_only' ); |
5561 | | } |
5562 | | |
5563 | | /** |
5564 | | * Adds slashes only if the provided value is a string. |
5565 | | * |
5566 | | * @since 5.3.0 |
5567 | | * |
5568 | | * @param mixed $value |
5569 | | * @return mixed |
5570 | | */ |
5571 | | function addslashes_strings_only( $value ) { |
5572 | | return is_string( $value ) ? addslashes( $value ) : $value; |
5573 | | } |
5574 | | |
5575 | 5548 | /** |
5576 | 5549 | * Extract and return the first URL from passed content. |
5577 | 5550 | * |
diff --git a/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php b/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
index f709afa85a..2d69e9e903 100644
a
|
b
|
protected function update_meta_value( $object_id, $meta_key, $name, $value ) { |
372 | 372 | return true; |
373 | 373 | } |
374 | 374 | |
375 | | if ( ! update_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash_strings_only( $value ) ) ) { |
| 375 | if ( ! update_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) { |
376 | 376 | return new WP_Error( |
377 | 377 | 'rest_meta_database_error', |
378 | 378 | /* translators: %s: Custom field key. */ |