W3cubDocs

/WordPress

WP_REST_Attachments_Controller::post_process_item( WP_REST_Request $request )

Performs post processing on an attachment.

Parameters

$request

(WP_REST_Request) (Required) Full details about the request.

Return

(WP_REST_Response|WP_Error) Response object on success, WP_Error object on failure.

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

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 );
	}

Changelog

Version Description
5.3.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/post_process_item