- Timestamp:
- 10/17/2018 08:09:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
r43510 r43740 296 296 } 297 297 298 $meta_key = wp_slash( $meta_key );299 $meta_value = wp_slash( $value );300 301 298 // Do the exact same check for a duplicate value as in update_metadata() to avoid update_metadata() returning false. 302 299 $old_value = get_metadata( $meta_type, $object_id, $meta_key ); 300 $subtype = get_object_subtype( $meta_type, $object_id ); 303 301 304 302 if ( 1 === count( $old_value ) ) { 305 if ( $old_value[0] === $meta_value) {303 if ( (string) sanitize_meta( $meta_key, $value, $meta_type, $subtype ) === $old_value[0] ) { 306 304 return true; 307 305 } 308 306 } 309 307 310 if ( ! update_metadata( $meta_type, $object_id, $meta_key, $meta_value) ) {308 if ( ! update_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) { 311 309 return new WP_Error( 312 310 'rest_meta_database_error',
Note: See TracChangeset
for help on using the changeset viewer.