woocommerce_rest_pre_insert_(post_type) хук-фильтрWC 1.0

Filter the query_vars used in get_items for the constructed query.

The dynamic portion of the hook name, $this->post_type, refers to post_type of the post being prepared for insertion.

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

add_filter( 'woocommerce_rest_pre_insert_(post_type)', 'wp_kama_woocommerce_rest_pre_insert_post_type_filter', 10, 2 );

/**
 * Function for `woocommerce_rest_pre_insert_(post_type)` filter-hook.
 * 
 * @param stdClass        $data    An object representing a single item prepared for inserting or updating the database.
 * @param WP_REST_Request $request Request object.
 *
 * @return stdClass
 */
function wp_kama_woocommerce_rest_pre_insert_post_type_filter( $data, $request ){

	// filter...
	return $data;
}
$data(stdClass)
An object representing a single item prepared for inserting or updating the database.
$request(WP_REST_Request)
Request object.

Где вызывается хук

WC_REST_Webhooks_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Coupons_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Orders_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Products_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php 550
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $data, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php 301
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $coupon, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php 506
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $order, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 730
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $product, $request );

Где используется хук в WooCommerce

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