rest_product_review_trashable

Filter whether a product review is trashable.

Description

apply_filters( 'rest_product_review_trashable', (boolean) $empty_trash_days_0, (WP_Post) $product_review ); 

Return false to disable trash support for the product review.

Parameters (2)

0. $empty_trash_days_0 (boolean) => ( EMPTY_TRASH_DAYS > 0 )
Whether the object supports trashing.
1. $product_review (WP_Post)
The object being considered for trashing support.

Usage

To run the hook, copy the example below.
  1. $empty_trash_days_0 = apply_filters( 'rest_product_review_trashable', $empty_trash_days_0, $product_review ); 
  2.  
  3. if ( !empty( $empty_trash_days_0 ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the rest_product_review_trashable callback 
  2. function filter_rest_product_review_trashable( $empty_trash_days_0, $product_review ) { 
  3. // make filter magic happen here... 
  4. return $empty_trash_days_0
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'rest_product_review_trashable', 'filter_rest_product_review_trashable', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'rest_product_review_trashable', 'filter_rest_product_review_trashable', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/api/v1/class-wc-rest-product-reviews-controller.php  
  1. $supports_trash = apply_filters( 'rest_product_review_trashable', ( EMPTY_TRASH_DAYS > 0 ), $product_review );