woocommerce_rest_preprocess_product_review
Filters a review after it is prepared for the database.
Allows modification of the review right after it is prepared for the database.
Использование
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(массив)
- The prepared review data for wp_insert_comment.
- $request(WP_REST_Request)
- The current request.
Список изменений
С версии 3.5.0 | Введена. |
Где вызывается хук
woocommerce_rest_preprocess_product_review
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php 805
return apply_filters( 'woocommerce_rest_preprocess_product_review', $prepared_review, $request );