WP REST Cache source code

By Acato, on WordPress.org since 2019. 10,000+ active installs.

Browse code Download zip

Are you facing speed issues, using the WordPress REST API? This plugin will allow WordPress to cache the responses of the REST API, making it much faster. Below is its source code for every one of its 70 releases, what changed in the latest one, and how often it ships.

What changed in 2026.4.4

Released Nov 26, 2026, 9 minutes after 2026.4.3
  • Feature: Show an admin notice when many REST requests aren’t cached because they carry credentials (e.g. an Authorization header or HTTP authentication), explaining how to cache them. Added filters wp_rest_cache/credential_skips_notice_threshold and wp_rest_cache/credential_skips_sample_rate. Improvement: When Authorization is a cacheable request header, requests where the web server handles the Basic authentication are now cached per set of credentials as well. Improvement: Stored credentials in the Authorization and Proxy-Authorization request headers are masked in the wp-admin. Improvement: Added a FAQ item on why REST requests are no longer cached since version 2026.4.0. Fix: Typo in the plugin (de)activation notices.

10 files changed since 2026.4.3: 9 modified, 1 added, 0 removed.

Compare 2026.4.3 with 2026.4.4

Release history

70 releases since February 2019
  1. 2026.4.5 Nov 30, 2026
  2. 2026.4.4 Nov 26, 2026 Feature: Show an admin notice when many REST requests aren’t cached because they carry credentials (e.g. an Authorization header or HTTP authentication), explaining how to cache them. Added filters wp_rest_cache/credential_skips_notice_threshold and wp_rest_cache/credential_skips_sample_rate. Improvement: When Authorization is a cacheable request header, requests where the web server handles the Basic authentication are now cached per set of credentials as well. Improvement: Stored credentials in the Authorization and Proxy-Authorization request headers are masked in the wp-admin. Improvement: Added a FAQ item on why REST requests are no longer cached since version 2026.4.0. Fix: Typo in the plugin (de)activation notices.
  3. 2026.4.3 Nov 26, 2026 Security: Unauthenticated visitors could poison the cache by sending a GET request with a request body (e.g. a JSON body) or a method override (_method parameter or X-HTTP-Method-Override header). WordPress core uses these to generate the response, but they were not part of the cache key, so the response was served to all visitors of that URL. It was reported by Kang MinSeok (AhnLab) through Patchstack. All existing caches are flushed on update. Backwards compatibility: GET and HEAD requests with a request body, and requests with a method override, are no longer cached. For other request methods that are allowed to be cached (setting “Allowed request methods”) the request body is now part of the cache key, so requests with a different body no longer share a cache. The cache key of requests without a body is unchanged. The Endpoint_Api::save_cache() method now accepts the optional $server and $request arguments of the rest_pre_echo_response filter. Feature: Added filter wp_rest_cache/skip_get_request_with_body to allow caching of GET and HEAD requests with a request body (cached per body).
  4. 2026.4.2 Oct 30, 2026 Fix: Caches that expired, or that were flushed and cleaned up, were never removed from the database, causing the caches table to grow indefinitely. A daily cron job now removes them (unless cache regeneration is enabled). It was reported by krstarica. Improvement: The cache regeneration cron no longer loads the entire caches table into memory. Feature: Added filters wp_rest_cache/purge_stale_caches, wp_rest_cache/stale_cache_grace_period and wp_rest_cache/max_purge_caches.
  5. 2026.4.1 Oct 29, 2026 Fix: Deleted caches that had been flushed and cleaned up before were never removed from the database, causing the caches table to grow indefinitely. Existing leftover caches are removed by the cleanup cron. It was reported by krstarica.
Full WP REST Cache changelog with diffs

Source of 2026.4.4

34 files
Browse all WP REST Cache 2026.4.4 files Browse trunk