woocommerce_rest_pre_insert_product_review filter-hook . WC 3.5.0
Filters a review before it is inserted via the REST API.
Allows modification of the review right before it is inserted via wp_insert_comment(). Returning a WP_Error value from the filter will shortcircuit insertion and allow skipping further processing.
Usage
add_filter( 'woocommerce_rest_pre_insert_product_review', 'filter_function_name_5801', 10, 2 ); function filter_function_name_5801( $prepared_review, $request ){ // filter... return $prepared_review; }
- $prepared_review(array|WP_Error)
- The prepared review data for wp_insert_comment().
- $request(WP_REST_Request)
- Request used to insert the review.
Changelog
Since 3.5.0 | Introduced. |
Where the hook is called
woocommerce_rest_pre_insert_product_review
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php 452
$prepared_review = apply_filters( 'woocommerce_rest_pre_insert_product_review', $prepared_review, $request );