woocommerce_rest_product_review_query
Filters arguments, before passing to WP_Comment_Query, when querying reviews via the REST API.
Usage
add_filter( 'woocommerce_rest_product_review_query', 'wp_kama_woocommerce_rest_product_review_query_filter', 10, 2 ); /** * Function for `woocommerce_rest_product_review_query` filter-hook. * * @param array $prepared_args Array of arguments for WP_Comment_Query. * @param WP_REST_Request $request The current request. * * @return array */ function wp_kama_woocommerce_rest_product_review_query_filter( $prepared_args, $request ){ // filter... return $prepared_args; }
- $prepared_args(array)
- Array of arguments for WP_Comment_Query.
- $request(WP_REST_Request)
- The current request.
Changelog
Since 3.5.0 | Introduced. |
Where the hook is called
woocommerce_rest_product_review_query
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php 312
$prepared_args = apply_filters( 'woocommerce_rest_product_review_query', $prepared_args, $request );