woocommerce_rest_(post_type)_trashable
Filter whether an item is trashable.
Return false to disable trash support for the item.
Usage
add_filter( 'woocommerce_rest_(post_type)_trashable', 'wp_kama_woocommerce_rest_post_type_trashable_filter', 10, 2 ); /** * Function for `woocommerce_rest_(post_type)_trashable` filter-hook. * * @param boolean $supports_trash Whether the item type support trashing. * @param WP_Post $post The Post object being considered for trashing support. * * @return boolean */ function wp_kama_woocommerce_rest_post_type_trashable_filter( $supports_trash, $post ){ // filter... return $supports_trash; }
- $supports_trash(true|false)
- Whether the item type support trashing.
- $post(WP_Post)
- The Post object being considered for trashing support.
Where the hook is called
woocommerce_rest_(post_type)_trashable
woocommerce_rest_(post_type)_trashable
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 1654
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_trashable", $supports_trash, $post );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php 434
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_trashable", $supports_trash, $post );
Where the hook is used in WooCommerce
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php 50
add_filter( "woocommerce_rest_{$this->post_type}_trashable", '__return_false' );
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' );