WP_REST_Attachments_Controller::post_process_item()
Performs post processing on an attachment.
Method of the class: WP_REST_Attachments_Controller{}
No Hooks.
Return
WP_REST_Response|WP_Error
. Response object on success, WP_Error object on failure.
Usage
$WP_REST_Attachments_Controller = new WP_REST_Attachments_Controller(); $WP_REST_Attachments_Controller->post_process_item( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
Changelog
Since 5.3.0 | Introduced. |
WP_REST_Attachments_Controller::post_process_item() WP REST Attachments Controller::post process item code WP 6.3
public function post_process_item( $request ) { switch ( $request['action'] ) { case 'create-image-subsizes': require_once ABSPATH . 'wp-admin/includes/image.php'; wp_update_image_subsizes( $request['id'] ); break; } $request['context'] = 'edit'; return $this->prepare_item_for_response( get_post( $request['id'] ), $request ); }