(hook_prefix)item_response
Filter the data for a response.
Usage
add_filter( '(hook_prefix)item_response', 'wp_kama_hook_prefixitem_response_filter', 10, 3 );
/**
* Function for `(hook_prefix)item_response` filter-hook.
*
* @param WP_REST_Response $response The response object.
* @param mixed $item WordPress representation of the item.
* @param WP_REST_Request $request Request object.
*
* @return WP_REST_Response
*/
function wp_kama_hook_prefixitem_response_filter( $response, $item, $request ){
// filter...
return $response;
}
- $response(WP_REST_Response)
- The response object.
- $item(mixed)
- WordPress representation of the item.
- $request(WP_REST_Request)
- Request object.
Changelog
| Since 10.2.0 | Introduced. |
Where the hook is called
(hook_prefix)item_response
woocommerce/src/Internal/RestApi/Routes/V4/AbstractController.php 177
return rest_ensure_response( apply_filters( $this->get_hook_prefix() . 'item_response', $response, $item, $request ) );