woocommerce_rest_preprocess_product_review filter-hookWC 3.5.0

Filters a review after it is prepared for the database.

Allows modification of the review right after it is prepared for the database.

Usage

add_filter( 'woocommerce_rest_preprocess_product_review', 'wp_kama_woocommerce_rest_preprocess_product_review_filter', 10, 2 );

/**
 * Function for `woocommerce_rest_preprocess_product_review` filter-hook.
 * 
 * @param array           $prepared_review The prepared review data for `wp_insert_comment`.
 * @param WP_REST_Request $request         The current request.
 *
 * @return array
 */
function wp_kama_woocommerce_rest_preprocess_product_review_filter( $prepared_review, $request ){

	// filter...
	return $prepared_review;
}
$prepared_review(array)
The prepared review data for wp_insert_comment.
$request(WP_REST_Request)
The current request.

Changelog

Since 3.5.0 Introduced.

Where the hook is called

WC_REST_Product_Reviews_Controller::prepare_item_for_database()
woocommerce_rest_preprocess_product_review
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php 782
return apply_filters( 'woocommerce_rest_preprocess_product_review', $prepared_review, $request );

Where the hook is used in WooCommerce

Usage not found.