This plugin enables caching for the WordPress REST API to improve performance. Once enabled you can modify the basic settings via the Customizer.
Several Headers are added to all the API Requests. This plugin will also modify the Cache-Control header as well. Here is an example of the available custom headers.
X-API-CACHE-PRO: Cached X-API-CACHE-PRO-EXPIRES: January 20, 2019, 12:39 AM UTC X-API-CACHE-PRO-EXPIRES-DIFF: 5 mins X-API-CACHE-PRO-KEY: api_cache_pro_78be25416f69cd3a885dcf14017a0691
This plugin offers several filters so you can disable these headers:
Filter
Type
Default
api_cache_pro_header
boolean
true
api_cache_pro_key_header
boolean
true
api_cache_pro_expires_header
boolean
true
api_cache_pro_expires_diff_header
boolean
true
api_cache_pro_control_header
boolean
true
api_cache_pro_max_age
integer
Default Timeout or 300 (5 Minutes)
api_cache_pro_s_max_age
integer
Default Timeout or 300 (5 Minutes)
You can use these filters to disable any of the headers. Here is an example to disable the Key Header.
/** * Disable API Cache Pro Key Header. * * @access public */ function disable_api_cache_pro_key_header() { return false; } add_action( 'api_cache_pro_key_header', 'disable_api_cache_pro_key_header' );
The cache will automatically get cleared if you do any of the following:
You can skip that cache by adding the following param to any request:
`cache=disabled<pre><h3>WP-CLI Support</h3>
API Cache Pro offers wp-cli support to clear cache with the following command:
wp api-cache-pro delete
`