WordPress at a glance
function is not described


Themes::prepare_item_for_response() public WC 1.0

Prepare the data object for response.

{} It's a method of the class: Themes{}

Hooks from the method

WP_REST_Response. $response Response data.


$Themes = new Themes();
$Themes->prepare_item_for_response( $item, $request );
$item(object) (required)
Data object.
$request(WP_REST_Request) (required)
Request object.

Code of Themes::prepare_item_for_response() WC 5.2.2

public function prepare_item_for_response( $item, $request ) {
	$data     = $this->add_additional_fields_to_object( $item, $request );
	$data     = $this->filter_response_by_context( $data, 'view' );
	$response = rest_ensure_response( $data );

	 * Filter the list returned from the API.
	 * @param WP_REST_Response $response The response object.
	 * @param array            $item     The original item.
	 * @param WP_REST_Request  $request  Request used to generate the response.
	return apply_filters( 'woocommerce_rest_prepare_themes', $response, $item, $request );