woocommerce_rest_insert_(post_type)_object
Fires after a single object is created or updated via the REST API.
Использование
add_action( 'woocommerce_rest_insert_(post_type)_object', 'wp_kama_woocommerce_rest_insert_post_type_object_action', 10, 3 ); /** * Function for `woocommerce_rest_insert_(post_type)_object` action-hook. * * @param WC_Data $object Inserted object. * @param WP_REST_Request $request Request object. * @param boolean $creating True when creating object, false when updating. * * @return void */ function wp_kama_woocommerce_rest_insert_post_type_object_action( $object, $request, $creating ){ // action... }
- $object(WC_Data)
- Inserted object.
- $request(WP_REST_Request)
- Request object.
- $creating(true|false)
- True when creating object, false when updating.
Где вызывается хук
woocommerce_rest_insert_(post_type)_object
woocommerce_rest_insert_(post_type)_object
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php 221
do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, true );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php 268
do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, false );
Где используется хук в WooCommerce
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 55
add_action( "woocommerce_rest_insert_{$this->post_type}_object", array( $this, 'clear_transients' ) );