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

WC_REST_Product_Attributes_V1_Controller::delete_item() public WC 1.0

Delete a single attribute.

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

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

WP_REST_Response/WP_Error.

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

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

Код WC_REST_Product_Attributes_V1_Controller::delete_item() WC 4.7.1

<?php
public function delete_item( $request ) {
	$force = isset( $request['force'] ) ? (bool) $request['force'] : false;

	// We don't support trashing for this type, error out.
	if ( ! $force ) {
		return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce' ), array( 'status' => 501 ) );
	}

	$attribute = $this->get_attribute( (int) $request['id'] );

	if ( is_wp_error( $attribute ) ) {
		return $attribute;
	}

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

	$deleted = wc_delete_attribute( $attribute->attribute_id );

	if ( false === $deleted ) {
		return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) );
	}

	/**
	 * Fires after a single attribute is deleted via the REST API.
	 *
	 * @param stdObject        $attribute     The deleted attribute.
	 * @param WP_REST_Response $response The response data.
	 * @param WP_REST_Request  $request  The request sent to the API.
	 */
	do_action( 'woocommerce_rest_delete_product_attribute', $attribute, $response, $request );

	return $response;
}