woocommerce_hydration_request_after_callbacks
Similar to WP core's rest_request_after_callbacks this allows to modify the response after it has been generated. Allows backward compatibility with the rest_request_after_callbacks by providing the same arguments.
Использование
add_filter( 'woocommerce_hydration_request_after_callbacks', 'wp_kama_woocommerce_hydration_request_after_callbacks_filter', 10, 3 ); /** * Function for `woocommerce_hydration_request_after_callbacks` filter-hook. * * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client. Usually a WP_REST_Response or WP_Error. * @param array $handler Route handler used for the request. * @param WP_REST_Request $request Request used to generate the response. * * @return WP_REST_Response|WP_HTTP_Response|WP_Error|mixed */ function wp_kama_woocommerce_hydration_request_after_callbacks_filter( $response, $handler, $request ){ // filter... return $response; }
- $response(WP_REST_Response|WP_HTTP_Response|WP_Error|разное)
- Result to send to the client. Usually a WP_REST_Response or WP_Error.
- $handler(массив)
- Route handler used for the request.
- $request(WP_REST_Request)
- Request used to generate the response.
Список изменений
С версии 8.9.0 | Введена. |
Где вызывается хук
woocommerce_hydration_request_after_callbacks
woocommerce/src/Blocks/Domain/Services/Hydration.php 169
$response = apply_filters( 'woocommerce_hydration_request_after_callbacks', $response, $handler, $request );