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

WC_REST_Product_Reviews_V1_Controller::update_item() public WC 1.0

Update a single product review.

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

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

WP_Error/WP_REST_Response.

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

$WC_REST_Product_Reviews_V1_Controller = new WC_REST_Product_Reviews_V1_Controller();
$WC_REST_Product_Reviews_V1_Controller->update_item( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код WC_REST_Product_Reviews_V1_Controller::update_item() WC 4.7.0

<?php
public function update_item( $request ) {
	$product_review_id = (int) $request['id'];
	$product_id        = (int) $request['product_id'];

	if ( 'product' !== get_post_type( $product_id ) ) {
		return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) );
	}

	$review = get_comment( $product_review_id );

	if ( empty( $product_review_id ) || empty( $review ) || intval( $review->comment_post_ID ) !== $product_id ) {
		return new WP_Error( 'woocommerce_rest_product_review_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
	}

	$prepared_review = $this->prepare_item_for_database( $request );

	$updated = wp_update_comment( $prepared_review );
	if ( 0 === $updated ) {
		return new WP_Error( 'rest_product_review_failed_edit', __( 'Updating product review failed.', 'woocommerce' ), array( 'status' => 500 ) );
	}

	if ( ! empty( $request['rating'] ) ) {
		update_comment_meta( $product_review_id, 'rating', $request['rating'] );
	}

	$product_review = get_comment( $product_review_id );
	$this->update_additional_fields_for_object( $product_review, $request );

	/**
	 * Fires after a single item is created or updated via the REST API.
	 *
	 * @param WP_Comment         $comment      Inserted object.
	 * @param WP_REST_Request $request   Request object.
	 * @param boolean         $creating  True when creating item, false when updating.
	 */
	do_action( "woocommerce_rest_insert_product_review", $product_review, $request, true );

	$request->set_param( 'context', 'edit' );
	$response = $this->prepare_item_for_response( $product_review, $request );

	return rest_ensure_response( $response );
}