- Timestamp:
- 01/19/2023 09:46:58 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r54855 r55102 4587 4587 } 4588 4588 4589 public function additional_field_get_callback( $object ) {4590 return get_post_meta( $object['id'], 'my_custom_int', true );4591 } 4592 4593 public function additional_field_update_callback( $value, $post ) {4589 public function additional_field_get_callback( $object, $field_name ) { 4590 return get_post_meta( $object['id'], $field_name, true ); 4591 } 4592 4593 public function additional_field_update_callback( $value, $post, $field_name ) { 4594 4594 if ( 'returnError' === $value ) { 4595 4595 return new WP_Error( 'rest_invalid_param', 'Testing an error.', array( 'status' => 400 ) ); 4596 4596 } 4597 update_post_meta( $post->ID, 'my_custom_int', $value );4597 update_post_meta( $post->ID, $field_name, $value ); 4598 4598 } 4599 4599
Note: See TracChangeset
for help on using the changeset viewer.