WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_REST_Product_Reviews_V1_Controller::prepare_item_for_response() public WC 1.0

Prepare a single product review output for response.

{} Это метод класса: WC_REST_Product_Reviews_V1_Controller{}

Хуки из метода
Возвращает

WP_REST_Response. $response Response data.

Использование

$WC_REST_Product_Reviews_V1_Controller = new WC_REST_Product_Reviews_V1_Controller();
$WC_REST_Product_Reviews_V1_Controller->prepare_item_for_response( $review, $request );
$review(WP_Comment) (обязательный)
Product review object.
$request(WP_REST_Request) (обязательный)
Request object.

Код WC_REST_Product_Reviews_V1_Controller::prepare_item_for_response() WC 4.7.1

<?php
public function prepare_item_for_response( $review, $request ) {
	$data = array(
		'id'           => (int) $review->comment_ID,
		'date_created' => wc_rest_prepare_date_response( $review->comment_date_gmt ),
		'review'       => $review->comment_content,
		'rating'       => (int) get_comment_meta( $review->comment_ID, 'rating', true ),
		'name'         => $review->comment_author,
		'email'        => $review->comment_author_email,
		'verified'     => wc_review_is_from_verified_owner( $review->comment_ID ),
	);

	$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
	$data    = $this->add_additional_fields_to_object( $data, $request );
	$data    = $this->filter_response_by_context( $data, $context );

	// Wrap the data in a response object.
	$response = rest_ensure_response( $data );

	$response->add_links( $this->prepare_links( $review, $request ) );

	/**
	 * Filter product reviews object returned from the REST API.
	 *
	 * @param WP_REST_Response $response The response object.
	 * @param WP_Comment       $review   Product review object used to create response.
	 * @param WP_REST_Request  $request  Request object.
	 */
	return apply_filters( 'woocommerce_rest_prepare_product_review', $response, $review, $request );
}