Custom Endpoint Not caching with Rest API
-
Hello
We have added the below code:
function wprc_add_acf_posts_endpoint( $allowed_endpoint ) { if ( ! isset( $allowed_endpoint[ 'custom/v2' ] ) || ! in_array( 'validateApi', $allowed_endpoint[ 'custom/v2' ] ) ) { $allowed_endpoint[ 'custom/v2' ][] = 'validateApi'; } return $allowed_endpoint; } add_filter( 'wp_rest_cache/allowed_endpoints', 'wprc_add_acf_posts_endpoint', 10, 1); function wprc_add_cacheable_request_headers( $cacheable_headers ) { $cacheable_headers['custom/v2'] = 'X-custom-AUTH'; return $cacheable_headers; } add_filter('wp_rest_cache/cacheable_request_headers', 'wprc_add_cacheable_request_headers', 10, 1);
We are using this custom endpoint request :
https://customstg.wpengine.com/wp-json/custom/v2/validateApi?apiKey=[randomkey]&package=[package] with GET method.
We are passing headers with this key: X-custom-AUTH
But it still does not show in the Endpoint API Caches listing.
Could you please suggest what do we need to make correct?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Endpoint Not caching with Rest API’ is closed to new replies.