$schema =
$this->
get_item_schema();
// Extract by name.
$attachment_id =
$insert['attachment_id'
];
$file =
$insert['file'
];
if ( isset( $request['alt_text'
] ) ) { update_post_meta( $attachment_id, '_wp_attachment_image_alt',
sanitize_text_field( $request['alt_text'
] ) );
} if ( !
empty( $schema['properties'
]['meta'
] ) &&
isset( $request['meta'
] ) ) { $meta_update =
$this->meta->
update_value( $request['meta'
],
$attachment_id );
if ( is_wp_error( $meta_update ) ) { return $meta_update;
} } $attachment =
get_post( $attachment_id );
$fields_update =
$this->
update_additional_fields_for_object( $attachment,
$request );
if ( is_wp_error( $fields_update ) ) { return $fields_update;
}