Changeset 56075
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
r54133 r56075 369 369 $meta_type = $this->get_meta_type(); 370 370 371 372 373 374 375 376 377 378 379 380 371 381 if ( ! current_user_can( "edit_{$meta_type}_meta", $object_id, $meta_key ) ) { 372 382 return new WP_Error( … … 379 389 ) 380 390 ); 381 }382 383 // Do the exact same check for a duplicate value as in update_metadata() to avoid update_metadata() returning false.384 $old_value = get_metadata( $meta_type, $object_id, $meta_key );385 $subtype = get_object_subtype( $meta_type, $object_id );386 387 if ( is_array( $old_value ) && 1 === count( $old_value )388 && $this->is_meta_value_same_as_stored_value( $meta_key, $subtype, $old_value[0], $value )389 ) {390 return true;391 391 } 392 392 -
trunk/tests/phpunit/tests/rest-api/rest-post-meta-fields.php
r55562 r56075 2301 2301 2302 2302 /** 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2303 2339 * @ticket 43392 2304 2340 */
Note: See TracChangeset
for help on using the changeset viewer.