diff --git a/src/api/endpoints/class-tainacan-rest-fields-controller.php b/src/api/endpoints/class-tainacan-rest-fields-controller.php index 8e2630e35..49309d8f5 100644 --- a/src/api/endpoints/class-tainacan-rest-fields-controller.php +++ b/src/api/endpoints/class-tainacan-rest-fields-controller.php @@ -117,16 +117,16 @@ class TAINACAN_REST_Fields_Controller extends TAINACAN_REST_Controller { $collection = new Entities\Collection( $collection_id ); $field->set_collection( $collection ); - } + } else { + $meta = json_decode( $request, true ); + foreach ( $meta as $key => $value ) { + $set_ = 'set_' . $key; + $field->$set_( $value ); + } - $meta = json_decode($request, true); - foreach ( $meta as $key => $value ) { - $set_ = 'set_' . $key; - $field->$set_( $value ); + $field->set_collection_id( 'default' ); } - $field->set_collection_id('default'); - return $field; }