Rockfire – REST API Cache stores the JSON responses of the WordPress REST API and serves repeated anonymous GET requests from the cache, before most of WordPress has loaded. Cached responses are flushed when the content they contain changes, so headless front ends, apps and decoupled sites get fast
PricingFree downloadThe WordPress.org download is free. Pro versions, add-ons or external services may cost extra.
CompatibilityRequires WordPress 6.6 and PHP 8.1.
SourceWordPress plugins · Nov 29, 2026
01 / Source details
Aboutthistool.
Rockfire – REST API Cache stores the JSON responses of the WordPress REST API and serves repeated anonymous GET requests from the cache, before most of WordPress has loaded. Cached responses are flushed when the content they contain changes, so headless front ends, apps and decoupled sites get fast responses without stale data.
The full documentation, with a getting-started guide, every hook and the migration from WP REST Cache, is at rockfire.nl/docs .
Features
Early serving. A small must-use file serves cache hits before regular plugins and the theme load. Without it the plugin still works in fallback mode and serves hits from plugins_loaded .
Route manager. Every readable wp/v2 route and the oEmbed route are cached by default. Under REST API Cache → Routes you enable or exclude any registered route (or a wildcard family of routes) and set its TTL, accepted parameters, ignored and bypass parameters, vary headers, and the post types and taxonomies whose changes flush it. Routes that only have POST , PUT or PATCH handlers are listed too, and a route can opt in to caching the POST , PUT or PATCH methods it registers (never on wp/v2 ).
Tag-based invalidation. Every cached response is tagged with the posts, terms, users, comments and lists it contains. Saving, trashing or deleting content, and changing terms, REST-exposed meta, users, comments or relevant options flushes the responses carrying those tags. A post response only refers to its terms, so adding another post to one of its categories or removing one from it, and renaming or describing a category, flush the category’s own responses but not the other posts in it. A post response is flushed when its own terms change, or when one of its terms is deleted or gets a new slug or parent.
Public PHP API. Flush by tag, URL, route or everything, and add your own tags to responses: rfrac_flush_tag() , rfrac_flush_url() , rfrac_flush_route() , rfrac_flush_all() and rfrac_tag_response() .
Pruning and limits. An hourly maintenance run deletes flushed and expired entries and evicts the least recently used entries above the entry limit. The payload size, the number of query parameters, the query length and the number of tags per entry are limited.
Object-cache store. With a persistent object cache the payloads are served from the object cache, so the plugin looks up and serves a hit without querying its database tables.
WP-CLI. wp rfrac flush , wp rfrac list , wp rfrac status , wp rfrac prune and wp rfrac config get .
Multisite. Per-site tables and settings, network activation, automatic setup of new sites and --network options in WP-CLI.
WooCommerce. With WooCommerce active, the public Store API catalog (products, categories, brands, tags, attributes and reviews) can be cached once you enable it under REST API Cache → Routes. The cart, checkout, orders and every logged-in shopper are never cached.
Admin screens and Site Health. Browse and flush cached responses, manage routes and settings, check the must-use file and run maintenance from the REST API Cache menu; Site Health reports problems.
Documentation
Getting started – requirements, installation and checking that responses are cached.
Hooks reference – every action and filter, with its parameters and examples.
Switching from WP REST Cache – the import, the notices and the report explained.
FAQ – including why an endpoint is not cached.
What is never cached
Requests from logged-in users; requests with an Authorization header, a nonce (the X-WP-Nonce header or a _wpnonce parameter, unless the rfrac/nonce_caching filter lets a logged-out request that only carries a nonce be cached), an API key header or a login, session or post password cookie (a login cookie is never cached, whatever the filters say); requests with a method the route is not opted in to (only GET , unless the route opts in to POST , PUT or PATCH ); requests with an X-HTTP-Method-Override header; GET requests that carry a body; requests with a multipart, invalid or oversized body, or a body that is neither JSON nor a URL-encoded form; a context other than view or embed ; status queries other than publish ; requests with a response format parameter ( _jsonp , _envelope , _pretty or _method ); the routes on the hard deny-list ( /wp/v2/users/me , /batch/v1 , the WooCommerce Store API cart, checkout, order, batch and shopper-list routes, and the WooCommerce wc/agentic and wc/private routes); requests over the limits (a route longer than 191 bytes, a query string longer than 2048 bytes, more query parameters than the configured maximum, or a route or parameter that is not valid UTF-8; the route is checked as sent, so a percent-encoded byte such as %FF in the path is plain ASCII); and responses that are not 200 OK , are empty result sets, are larger than the payload limit, carry more tags than the tag limit, set a cookie, are marked private , no-store , no-cache or max-age=0 , or are vetoed by the rfrac/store_allowed filter. No new responses are stored while the cache holds about 1.5 times the entry limit, until maintenance has pruned it.
Credits
Rockfire – REST API Cache is a fork of WP REST Cache by Acato (https://wordpress.org/plugins/wp-rest-cache/), GPLv3.
Significant changes from WP REST Cache
Security fixes: responses are never cached for authenticated requests (logged-in users, Authorization , nonces unless the rfrac/nonce_caching filter lets a logged-out request that only carries a nonce be cached, credential headers and cookies; a login cookie always bypasses); routes are matched strictly against the registered routes; the cache key is built from the parameters a route knows, and unknown parameters bypass the cache instead of creating new entries; sizes and counts are limited; the plugin makes no outbound HTTP requests and stores no credentials; only an allow-list of response headers is replayed.
A new architecture and database schema ( rfrac_entries and rfrac_tags ), a compiled configuration that the early phase reads without loading other plugins, and a database or object-cache store.
A route manager instead of a list of allowed endpoints.
Tag-based invalidation instead of object-type relations, with a public PHP API.
Pruning and size limits keep the cache tables bounded.
The wp rfrac WP-CLI commands.
Full multisite support.
A real uninstall that removes every table, option, transient, user meta key, cron event and the must-use file.
The cache regeneration cron and the upsell have been removed.
Must-use file
What: the plugin installs wp-content/mu-plugins/rfrac-early-cache.php (in the must-use plugins directory, WPMU_PLUGIN_DIR ). It is a small loader that does nothing unless this plugin is active.
Why: must-use plugins load before regular plugins, so a cache hit is served before other plugins and the theme are loaded. That is what makes a hit fast.
When it is written: at exactly three moments. On activation (on multisite only when the activating user may manage network plugins, manage_network_plugins ; an activation by a site administrator or from WP-CLI does not write it). When someone clicks the “Install must-use file” button (a user who may manage plugins, activate_plugins ; on multisite manage_network_plugins , because the file is shared by the whole network). And when this plugin is updated, by any updater (including automatic updates), while an outdated copy built from the plugin’s template (it carries an RFRAC Template: header) already exists: that copy is refreshed. An update never creates a missing file and never touches a file that is not built from the template. Nothing else writes the file. It is written atomically: a temporary file is written, verified and renamed into place, and the plugin never asks for FTP credentials.
Notice: when the file is missing or outdated, a notice with an “Install must-use file” button appears on the Plugins screen and on the plugin’s own pages for a user who may install it, and the plugin serves cache hits from plugins_loaded (fallback mode) until it is installed.
When it is removed: on deactivation, unless the plugin is still active on another site of the network, and on uninstall.
Fallback mode: when the file cannot be written (the directory is not writable, WordPress cannot write files directly, or DISALLOW_FILE_MODS is set) the plugin keeps working and serves cache hits from plugins_loaded . REST API Cache → Tools and Site Health show the mode and the reason.
Manual install: copy wp-content/plugins/rockfire-rest-api-cache/mu-plugin/rfrac-early-cache.php to wp-content/mu-plugins/rfrac-early-cache.php , then in the copy replace {{RFRAC_PLUGIN_VERSION}} with the plugin version and {{RFRAC_PLUGIN_BASENAME}} with rockfire-rest-api-cache/rockfire-rest-api-cache.php . REST API Cache → Tools shows the exact values for your site.
Opting out: add define( 'RFRAC_DISABLE_MU_INSTALL', true ); to wp-config.php and the plugin never writes the file.
Privacy
The plugin does not track users, does not send data to external services and makes no external HTTP requests. It only caches public REST API responses: requests carrying credentials are never cached. All cached data is stored in your own database (or object cache) and is removed when the plugin is uninstalled.
See it in action
Screenshots & previews.
Caches: the cached REST API responses with their method, route, state, size, hits and expiry, ready to flush or delete.Routes: every registered REST route with its namespace, caching status, TTL and parameters.A route's edit view: its status, the methods it caches and its parameters.Settings: defaults and request rules.Tools: the status of the must-use file and the cache, and flushing by tag, URL or route.
02 / Source details
Gettingstarted.
01Install the plugin from Plugins → Add New, or upload the rockfire-rest-api-cache folder to wp-content/plugins/ .
02Activate the plugin (network-activate it on multisite to cache every site). Activation creates the cache tables and installs the must-use file.
03If the must-use file is missing or outdated, a notice on the Plugins screen and on the plugin’s pages offers an “Install must-use file” button. Open REST API Cache → Tools to check that the file is installed and serving early; if it cannot be written, follow the manual install instructions shown there.
04Review REST API Cache → Routes: the wp/v2 routes and the oEmbed route are cached by default; enable the routes of other plugins you want to cache.
05Optionally adjust REST API Cache → Settings (default and maximum TTL, entry limit, payload size, store).
06Check that responses are cached .
Do not run this plugin together with WP REST Cache: deactivate WP REST Cache first.
Configuration constants (in wp-config.php ; a constant locks the matching setting in the admin):
08RFRAC_STORE – auto (default: the object cache when a persistent object cache is available, else the database), database or object_cache .
09RFRAC_DEFAULT_TTL – default time to live in seconds (default 86400).
10RFRAC_MAX_TTL – maximum time to live in seconds (default 2592000).
11RFRAC_MAX_ENTRIES – maximum number of cached responses per site (default 10000).
12RFRAC_MAX_PAYLOAD_KB – largest response stored, in KB (default 1024).
13RFRAC_MAX_PARAMS – maximum number of query parameters of a cached request (default 20).
14RFRAC_HIT_SAMPLING – count one hit in N for the statistics; 0 disables hit counting (default 10).
15RFRAC_GLOBAL_IGNORE_PARAMS – query parameters that never change the cache key on any route, for example define( 'RFRAC_GLOBAL_IGNORE_PARAMS', array( 'utm_source', 'fbclid' ) ); (an array, or one string separated by commas or spaces; at most 20 names of letters, digits and _-.[] ). The constant locks the setting under REST API Cache → Settings, and the rfrac/global_ignore_params filter still applies on top of it. A parameter a route registers is never ignored on that route. A value that is not valid (a bad name or too many names) is ignored and reported; array() locks the list to empty.
16RFRAC_GLOBAL_VARY_HEADERS – request headers that vary the cache key on every route, for example define( 'RFRAC_GLOBAL_VARY_HEADERS', array( 'Accept-Language' ) ); (an array, or one string separated by commas or spaces; names are lowercased and an underscore counts as a dash). At most 5 headers together with the vary headers of each route; Authorization , Cookie , Set-Cookie , Proxy-Authorization and X-WP-Nonce are not allowed. The constant locks the setting, and the rfrac/global_vary_headers filter still applies on top of it. Unlike the other constants, a value that is not valid is not set aside for the stored setting: it is reported, and no route is cached until it is fixed, because caching with a different list would serve one shared response to visitors who should get their own.
17RFRAC_NONCE_CACHING – whether a logged-out request that only carries a REST nonce (the X-WP-Nonce header or a _wpnonce parameter) may be cached (default false), for example define( 'RFRAC_NONCE_CACHING', true ); . A cache hit never verifies the nonce, and every other credential signal and every login cookie still bypasses. The constant locks the Cache requests with a REST nonce setting under REST API Cache → Settings, and the rfrac/nonce_caching filter still applies on top of it. A value that is not a boolean is ignored and reported as the plugin’s last error.
18RFRAC_ROUTES – route rules defined in code, keyed by route, for example define( 'RFRAC_ROUTES', array( '/my/v1/header' => array( 'status' => 'enabled', 'ttl' => 3600 ) ) ); . A rule can also list the request methods it caches, for example 'methods' => array( 'GET', 'POST' ) ( GET when absent; POST , PUT and PATCH only for methods the route registers, never on wp/v2 ; see “Can I cache POST, PUT or PATCH requests?”). These routes are read-only in the admin.
19RFRAC_ALLOW_SKIP_CACHE – whether the skip_cache request parameter bypasses the cache (default false).
20RFRAC_BYPASS_COOKIES – extra cookie name prefixes that bypass the cache (array). Entries that are not valid cookie name characters (letters, digits and the other cookie name characters such as - , _ , . and ! , but not % ; at most 128) are ignored and reported as the plugin’s last error; a . matches _ , the name PHP gives the cookie.
21RFRAC_BYPASS_HEADERS – extra request headers that carry credentials and bypass the cache (array). Entries that are not header names (letters, digits, dashes and underscores, at most 64; an underscore counts as a dash, as PHP can not tell them apart) are ignored and reported as the plugin’s last error.
22RFRAC_CORS_WILDCARD – send Access-Control-Allow-Origin: * on cache hits for origins that are not allowed.
23RFRAC_DISABLE_MU_INSTALL – never write the must-use file.
03 / Source details
Frequently asked questions.
Why isn’t my endpoint cached?
REST API GET responses, and the POST , PUT and PATCH responses of routes that opted in to those methods, carry an X-Rfrac-Cache header: HIT (served from the cache), MISS (generated by WordPress and stored in the cache) or BYPASS (not served from the cache and not stored). With WP_DEBUG enabled, a bypassed response also carries X-Rfrac-Cache-Reason , for example:
route_not_enabled – enable the route under REST API Cache → Routes.
unknown_param – the request uses a query parameter the route does not register. Add it to the route’s ignored parameters, to REST API Cache → Settings → Ignored query parameters to ignore it on every route, or let the route accept all parameters.
credentials – the request is authenticated or carries a bypass cookie or header, or a password parameter.
context or status_param – the request asks for non-public data.
denied_route – the route is on the hard deny-list and is never cached.
method , method_override or body – the route is not opted in to the request method (only GET , unless the route opts in to POST , PUT or PATCH ), the request carries an X-HTTP-Method-Override header, it is a GET request with any body, or its body is multipart, neither JSON nor a URL-encoded form, invalid, or larger than 64 KB.
format_param – the request uses _jsonp , _envelope , _pretty or _method .
bypass_param – the request uses one of the route’s bypass parameters.
visitor_varies – another plugin makes this route’s responses vary per visitor (e.g. WooCommerce prices with a tax-location plugin), so it is never cached.
vary_cookie – a declared cookie carries a value outside its allow-list.
skip_cache – the request uses skip_cache and skipping is allowed ( RFRAC_ALLOW_SKIP_CACHE or the rfrac/allow_skip_cache filter).
too_many_params or query_too_long – more query parameters than the configured maximum, or a query string longer than 2048 bytes.
coexistence – WP REST Cache is active; deactivate it.
disabled – caching is turned off in the settings or by RFRAC_DISABLE .
A cacheable request whose response is not stored is marked BYPASS too, with the reason the response was not stored:
status – the response is not 200 OK .
empty – the response is an empty result set (see the rfrac/cache_empty_results filter).
too_large – the response is larger than the payload limit.
set_cookie or private – the response sets a cookie, or is marked private , no-store , no-cache or max-age=0 .
user – a user was logged in while the response was generated.
too_many_tags – the response carries more tags than the tag limit.
entry_ceiling – the cache already holds 1.5 times the entry limit (the count includes responses stored moments ago and is recounted as it nears that ceiling); maintenance prunes it back to the limit.
vary_cookie – a cookie declaration changed since the configuration was compiled; the next recompile fixes it.
filtered – the rfrac/store_allowed filter vetoed storing, a wp_rest_cache/cache_key or wp_rest_cache/filter_cache_output callback is hooked while RFRAC_LEGACY_HIT_FILTERS is not defined, or the rfrac/bypass_all filter bypassed every request.
flushed – the cache was flushed after this request looked it up (for example, content was taken down while the response was being generated); the next request stores it again.
no_lookup – no lookup recorded a starting point for this request (which is how a flush in between is detected), for example on the first request after the plugin was updated, before its configuration was rebuilt; the next request normally stores it.
disabled – caching was turned off ( RFRAC_DISABLE ) while the response was being generated.
error – storing failed, or the tags of the response could not be collected completely; the error is shown on the plugin’s admin pages.
More causes and how to fix them: why an endpoint is not cached .
Can I cache POST, PUT or PATCH requests?
Yes, for front ends that read data with a POST , PUT or PATCH request (a search or filter endpoint, for example). It is an opt-in per route, and GET stays the only method cached everywhere else:
Under REST API Cache → Routes, edit the route and tick the methods to cache, or set 'methods' in a rule ( RFRAC_ROUTES ). Only methods the route registers a handler for can be chosen, and the route has to be enabled. Routes that only have POST , PUT or PATCH handlers are listed too.
Never on wp/v2 : core routes are only cached for GET . DELETE is never cached, and the deny-list and the credential checks apply to every method.
The cache key adds the method, the content type and a hash of the request body. application/json and application/x-www-form-urlencoded bodies are decoded and canonicalised first, so the order of the keys and the whitespace do not split the cache. Only the hash is stored, never the body.
A body larger than 64 KiB, a multipart body, a body that is not valid JSON or UTF-8, and any request with an X-HTTP-Method-Override header bypass the cache.
A GET with a body is never cached.
Warning: a cached POST , PUT or PATCH response is served without running the route’s handler, so anything the handler does besides returning data (saving, sending, counting) does not happen on a cache hit. Enable these methods only for routes that only read data. The route editor repeats this warning next to the method checkboxes.
How do I flush the cache from code?
Use the public API. Every flush function returns the number of flushed responses and acts on the current site:
rfrac_flush_tag( 'post:12' ); // Everything that contains post 12. rfrac_flush_tag( array( 'post:12', 'list:product' ) ); rfrac_flush_url( rest_url( 'wp/v2/posts' ) ); // One URL, including its query string. rfrac_flush_route( '/wp/v2/posts' ); // A route and everything below it. rfrac_flush_all(); // Everything of the current site.
Tags have the form prefix:value : post:{id} , term:{id} , term-ref:{id} , user:{id} , comment:{id} , list:{post type or taxonomy} , list:users , list:comments , or your own prefix. term:{id} marks responses that show a term (the term itself, term lists, embedded terms) and is flushed when the term changes; term-ref:{id} marks responses that only refer to the term, like a post with its categories , class_list and link, and is flushed only when the term is deleted or its slug or parent changes (for the term and its descendants). A value has no spaces or commas, so several tags can also be passed as one string separated by commas or spaces ( 'post:12, list:product' ). Tag your own responses while they are generated, for example in a route callback, and flush them later:
rfrac_tag_response( 'acf-options:header' ); // ... later, after the options were saved: rfrac_flush_tag( 'acf-options:header' );
Call these functions from plugins_loaded or later. A custom route such as /my/v1/header is only cached once you enable it under REST API Cache → Routes or in RFRAC_ROUTES : by default only the wp/v2 routes and the oEmbed route are cached.
With WooCommerce active, the tags of its public Store API responses are wc-price:all , wc-attribute:{id} , list:wc-attribute , list:wc-review and list:wc-popularity (carried by product lists sorted by popularity and flushed when a product’s sales count changes), plus the tags above that WooCommerce objects reuse: post:{id} , term:{id} , list:product , list:product_cat , list:product_tag , list:product_brand and list:pa_{attribute} (for example list:pa_color ). Flush them like any other tag. Changes to the location of a tax rate made by calling WooCommerce’s internal WC_Tax::_update_tax_rate_postcodes() or WC_Tax::_update_tax_rate_cities() directly are not detected: code that does this should flush the wc-price:all tag afterwards, for example rfrac_flush_tag( 'wc-price:all' ) .
Which hooks exist?
Actions to react to flushes, stores, failures, maintenance and the plugin lifecycle, such as rfrac/flushed (purge a CDN after a flush) and rfrac/stored . Filters to change routes, bypass rules, cache keys, tags, invalidation and admin access, such as rfrac/route_rules , rfrac/bypass_headers , rfrac/entry_ttl , rfrac/store_allowed and rfrac/settings_capability . Filters that are compiled into the configuration apply after the next recompile, such as a settings save.
Every hook, with its parameters and examples, is in the hooks reference and in includes/class-hooks.php .
Which WP-CLI commands are available?
wp rfrac flush --all , wp rfrac flush --tag=post:1,post:2 , wp rfrac flush --route=/wp/v2/posts and wp rfrac flush --request-url=https://example.com/wp-json/wp/v2/posts – flush cached responses. The URL option is named --request-url because WP-CLI reserves --url for selecting the site. wp rfrac list – list cached responses; filter and format with --route , --state , --search , --per-page , --page , --fields and --format . wp rfrac status – show the cache status, including whether the must-use file serves early. wp rfrac prune – run one maintenance pass. wp rfrac config get – show the effective settings and where each value comes from; --compiled prints the compiled configuration. wp rfrac import-legacy – import the settings of WP REST Cache and report what became of every value. wp rfrac import-legacy --dry-run prints what would happen and saves nothing; --format picks the output. The steps are described under “How do I switch from WP REST Cache?” below. On multisite, wp rfrac flush , wp rfrac list and wp rfrac prune accept --network to act on every site where the plugin is active. wp rfrac import-legacy --dry-run --network does the same for the import, in one WP-CLI process per site, so that each site loads its own plugins.
Why does a notice appear after I switch a plugin on or off?
A plugin can change what the REST API returns, so after any other plugin is activated or deactivated (from the admin, by AJAX or with WP-CLI) the cached responses of the site may be outdated. The plugin does not flush by itself: it shows a notice on the Plugins screen and on the plugin’s own admin pages, to users who may manage the plugin, with
FinderPress Media Auditor helps site administrators scan for broken images, missing Media Library files, unreachable media URLs, and other media issues across WordPress content. Use it to audit images, video, audio, PDFs, featured images, and attachment files without sending scan data to an external
The Accepted Payment Methods plugin is a straightforward, lightweight solution that enhances your website by displaying visually appealing icons of the payment methods you accept. This plugin is ideal for a variety of websites, including e-commerce platforms, service-oriented websites, and informati