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

WC_REST_Posts_Controller::update_item() WC 1.0

Update a single post.

Это метод класса: WC_REST_Posts_Controller

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

WP_Error/WP_REST_Response.

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

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

Код WC REST Posts Controller::update item: woocommerce/includes/abstracts/abstract-wc-rest-posts-controller.php WC 3.6.3

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

	if ( ! empty( $post->post_type ) && 'product_variation' === $post->post_type && 'product' === $this->post_type ) {
		return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/&lt;product_id&gt;/variations/&lt;id&gt; endpoint.', 'woocommerce' ), array( 'status' => 404 ) );
	} elseif ( empty( $id ) || empty( $post->ID ) || $post->post_type !== $this->post_type ) {
		return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) );
	}

	$post = $this->prepare_item_for_database( $request );
	if ( is_wp_error( $post ) ) {
		return $post;
	}
	// Convert the post object to an array, otherwise wp_update_post will expect non-escaped input.
	$post_id = wp_update_post( (array) $post, true );
	if ( is_wp_error( $post_id ) ) {
		if ( in_array( $post_id->get_error_code(), array( 'db_update_error' ) ) ) {
			$post_id->add_data( array( 'status' => 500 ) );
		} else {
			$post_id->add_data( array( 'status' => 400 ) );
		}
		return $post_id;
	}

	$post = get_post( $post_id );
	$this->update_additional_fields_for_object( $post, $request );

	// Update meta fields.
	$meta_fields = $this->update_post_meta_fields( $post, $request );
	if ( is_wp_error( $meta_fields ) ) {
		return $meta_fields;
	}

	/**
	 * Fires after a single item is created or updated via the REST API.
	 *
	 * @param WP_Post         $post      Post object.
	 * @param WP_REST_Request $request   Request object.
	 * @param boolean         $creating  True when creating item, false when updating.
	 */
	do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );

	$request->set_param( 'context', 'edit' );
	$response = $this->prepare_item_for_response( $post, $request );
	return rest_ensure_response( $response );
}