WP_REST_Attachments_Controller::post_process_item() public WP 5.3.0
Performs post processing on an attachment.
{} It's a 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. |
Code of WP_REST_Attachments_Controller::post_process_item() WP REST Attachments Controller::post process item WP 5.6
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 );
}