woocommerce_rest_api_not_modified_response
Filter the 304 Not Modified response before sending.
Usage
add_filter( 'woocommerce_rest_api_not_modified_response', 'wp_kama_woocommerce_rest_api_not_modified_response_filter', 10, 3 );
/**
* Function for `woocommerce_rest_api_not_modified_response` filter-hook.
*
* @param WP_REST_Response|false $response The 304 response object, or false to prevent sending it.
* @param WP_REST_Request $request The request object.
* @param string|null $endpoint_id The endpoint identifier.
*
* @return WP_REST_Response|false
*/
function wp_kama_woocommerce_rest_api_not_modified_response_filter( $response, $request, $endpoint_id ){
// filter...
return $response;
}
- $response(WP_REST_Response|false)
- The 304 response object, or false to prevent sending it.
- $request(WP_REST_Request)
- The request object.
- $endpoint_id(string|null)
- The endpoint identifier.
Changelog
| Since 10.5.0 | Introduced. |
Where the hook is called
woocommerce_rest_api_not_modified_response
woocommerce/src/Internal/Traits/RestApiCache.php 507
$filtered_response = apply_filters( 'woocommerce_rest_api_not_modified_response', $response, $request, $endpoint_id );