woocommerce_rest_product_review_trashable хук-фильтрWC 3.5.0

Filters whether a review can be trashed.

Return false to disable trash support for the post.

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

add_filter( 'woocommerce_rest_product_review_trashable', 'wp_kama_woocommerce_rest_product_review_trashable_filter', 10, 2 );

/**
 * Function for `woocommerce_rest_product_review_trashable` filter-hook.
 * 
 * @param bool       $supports_trash Whether the post type support trashing.
 * @param WP_Comment $review         The review object being considered for trashing support.
 *
 * @return bool
 */
function wp_kama_woocommerce_rest_product_review_trashable_filter( $supports_trash, $review ){

	// filter...
	return $supports_trash;
}
$supports_trash(true|false)
Whether the post type support trashing.
$review(WP_Comment)
The review object being considered for trashing support.

Список изменений

С версии 3.5.0 Введена.

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

WC_REST_Product_Reviews_Controller::delete_item()
woocommerce_rest_product_review_trashable
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php 638
$supports_trash = apply_filters( 'woocommerce_rest_product_review_trashable', ( EMPTY_TRASH_DAYS > 0 ), $review );

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

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