rest_product_review_trashable
Filter whether a product review is trashable.
Return false to disable trash support for the product review.
Использование
add_filter( 'rest_product_review_trashable', 'wp_kama_rest_product_review_trashable_filter', 10, 2 );
/**
* Function for `rest_product_review_trashable` filter-hook.
*
* @param boolean $supports_trash Whether the object supports trashing.
* @param WP_Post $product_review The object being considered for trashing support.
*
* @return boolean
*/
function wp_kama_rest_product_review_trashable_filter( $supports_trash, $product_review ){
// filter...
return $supports_trash;
}
- $supports_trash(true|false)
- Whether the object supports trashing.
- $product_review(WP_Post)
- The object being considered for trashing support.
Где вызывается хук
rest_product_review_trashable
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php 400
$supports_trash = apply_filters( 'rest_product_review_trashable', ( EMPTY_TRASH_DAYS > 0 ), $product_review );