woocommerce_rest_(post_type)_object_trashable
Filter whether an object is trashable.
Return false to disable trash support for the object.
Использование
add_filter( 'woocommerce_rest_(post_type)_object_trashable', 'wp_kama_woocommerce_rest_post_type_object_trashable_filter', 10, 2 ); /** * Function for `woocommerce_rest_(post_type)_object_trashable` filter-hook. * * @param boolean $supports_trash Whether the object type support trashing. * @param WC_Data $object The object being considered for trashing support. * * @return boolean */ function wp_kama_woocommerce_rest_post_type_object_trashable_filter( $supports_trash, $object ){ // filter... return $supports_trash; }
- $supports_trash(true|false)
- Whether the object type support trashing.
- $object(WC_Data)
- The object being considered for trashing support.
Где вызывается хук
woocommerce_rest_(post_type)_object_trashable
woocommerce_rest_(post_type)_object_trashable
woocommerce_rest_(post_type)_object_trashable
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 1572
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php 560
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php 474
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
Где используется хук в WooCommerce
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php 55
add_filter( "woocommerce_rest_{$this->post_type}_object_trashable", '__return_false' );