Directory / plugin
NiroCache – Simple Page Cache, Preload and Speed Optimization
v1.0.1 · by NiroSuite
Choose a performance preset and NiroCache handles the rest: static HTML page cache, smart purging, preloading and safe optimization.
About this plugin
Choose a preset. NiroCache handles the rest.
NiroCache makes your site faster by saving each page as a static HTML file and serving that file to visitors before WordPress even loads. Pages that took hundreds of milliseconds to build are delivered from a single file.
It works the moment you activate it. Standard mode is already selected: page caching, preloading, compression and minification start with safe defaults, and logged-in visitors, carts and checkouts are never cached. When you want more control, pick another preset or switch to Custom.
Performance modes
- Basic — the safest setup. Static HTML page cache, serve stale pages while rebuilding, browser caching, Gzip and Brotli compression (when your server supports them), home page preload and tracking-parameter handling. Your CSS and JavaScript are left untouched. For membership and highly dynamic sites.
- Standard (recommended, on by default) — everything in Basic, plus sitemap preload, cache warming, minified HTML, CSS and JavaScript, preconnect to important origins, and object cache recommendations on Automatic (NiroCache never installs an object cache; the Server screen tells you when Redis or Memcached could be connected).
- Aggressive — everything in Standard, plus deferred JavaScript, JavaScript delayed until the visitor interacts, and cached approved query strings. Some sites need exclusions in this mode, so check your key pages after choosing it.
- Custom — your own combination. Changing any setting a preset controls switches to Custom (NiroCache asks first), and your last Custom set is remembered. Combine CSS and JavaScript, inline CSS and JavaScript minification and a separate mobile cache are Custom-only.
Page cache
- Static HTML pages served by the standard WordPress early cache (
advanced-cache.php), before themes, plugins and database queries load. - Optional direct delivery by Apache or LiteSpeed through a marked
.htaccessblock, and a ready-to-copy configuration snippet for Nginx. - Serve stale while rebuilding with cache stampede protection: when a page expires, one request rebuilds it while other visitors get the previous copy.
- Precompressed Gzip and Brotli copies of cached pages.
- Query strings handled safely: tracking parameters such as
utm_source,utm_campaign,gclidandfbclidshare the cached page, approved parameters such as a language or currency get their own copies, and unknown parameters bypass the cache so variants never multiply. - Optional separate cache for mobile devices, for themes that send different HTML to phones.
- Configurable lifespan, plus a daily cleanup of expired pages.
Smart purging
- Updating a post clears the post, the home page, its category, tag and author archives, its post type archive and their pagination.
- Approved comments, WooCommerce stock and price changes clear the affected product or post.
- Theme, menu, widget, Customizer, Site Editor, permalink and general settings changes clear the whole cache, and so do settings changes that affect how pages look.
- Clear the cache from the dashboard, the admin toolbar, the post editor or WP-CLI. Clear & Preload rebuilds it straight away.
Preloading and cache warming
- Preloads your home page, the WordPress sitemap or your SEO plugin’s (Yoast SEO, Rank Math, SEOPress, All in One SEO) and any extra URLs you list.
- Paced batches with a pause between pages, so shared hosting is not overwhelmed; preloading resumes after interruptions and can be cancelled.
- Keeps the cache warm after a full purge and once a day. A single post update only rebuilds the pages it affects.
- Progress, pages waiting and the last preload on the dashboard.
Optimization
- Minify HTML, CSS and JavaScript. Minified copies live in the cache folder; your theme and plugin files are never modified.
- Defer JavaScript, and delay JavaScript until the visitor first moves the mouse, scrolls, taps, clicks or presses a key. Payment, checkout, consent and other sensitive scripts are never delayed.
- Preconnect to the other servers your pages load fonts and scripts from.
- Combine CSS and JavaScript, and minify inline CSS and JavaScript, in Custom mode.
- Exclusions for any file, URL fragment or inline-code keyword.
- Browser caching rules for images, fonts, CSS and JavaScript; pages themselves are never cached in the browser.
Dashboard
- An On/Off switch that pauses everything NiroCache does, with your settings kept.
- Pages served from cache, cache hit rate, pages cached and cache size.
- Charts for the last 7, 30 or 90 days: page requests by result (served from cache, generated and cached, bypassed), the hit-rate trend, and why pages were not cached. Every chart has a table view.
- One-click cache test: requests your home page twice and confirms a MISS then a HIT, or tells you exactly why not.
- Setup checks, with a Fix setup button when something is missing.
Server screen
- Web server, PHP and memory limits, HTTPS and HTTP version, OPcache, Gzip, Brotli, persistent object cache (Redis or Memcached) and cache directory status at a glance.
- Detects hosting caches such as LiteSpeed, Varnish, Cloudflare and managed WordPress hosts, and other page cache or optimization plugins that would conflict.
- Recommendations that separate genuine problems from optional improvements.
Safe by default
These are never cached: logged-in users, commenters, carts, checkout and account pages, search results, previews, password-protected content, 404 pages, feeds, REST API and AJAX requests, and form submissions. Pages that define DONOTCACHEPAGE or send Cache-Control: no-cache, no-store or private are respected.
You can also exclude URLs (with * wildcards), cookies, user agents, post types, and single pages with Don’t cache this page in the editor.
Compatibility
- WooCommerce, Easy Digital Downloads, EasyCommerce and NiroCommerce: cart, checkout and account pages stay dynamic, shoppers with items in their cart always get fresh pages, and product changes clear the right pages.
- Elementor: editor and preview requests are never cached, and saving a page or regenerating Elementor’s CSS clears the affected cache.
- Multisite: each site keeps its own cache, and super admins can clear every site at once.
- WP-CLI:
wp nirocache status,purge,preload,test,preset,enable,disableandsettings. - Works on Apache, Nginx, LiteSpeed and other servers.
What NiroCache changes on your site
Page caching in WordPress needs a few things outside the plugin folder. NiroCache sets them up for you, only where no other plugin is in charge, and removes only what it added:
wp-content/advanced-cache.php: the standard WordPress early-cache file, copied from the plugin. It is only created if no other plugin owns it.define( 'WP_CACHE', true );inwp-config.php: added only if WP_CACHE is not already defined. Ifwp-config.phpis not writable, NiroCache shows the line to add.- One block marked
# BEGIN NiroCachein.htaccess, on Apache and LiteSpeed only, for browser caching, compression and optional direct delivery. Other blocks are never touched.
Cached pages, minified files and statistics are stored in wp-content/cache/nirocache/. NiroCache never overwrites another plugin’s advanced-cache.php or object-cache.php.
Privacy
NiroCache does not collect or send any data, and has no account, API key or cloud service. The cache test, preloading and server checks only send requests from your server to your own site. Cached copies only ever contain pages as seen by visitors who are not logged in. Statistics are simple daily counts stored on your server.
For developers
Filters:
nirocache_should_cache— return false to keep a rendered page dynamic.nirocache_excluded_urls— URL path patterns that are never cached.nirocache_bypass_cookies— cookie name prefixes that make a visitor bypass the cache.nirocache_ignored_query_params— query parameters that share the cached copy.nirocache_allowed_query_params— query parameters that get their own cached copies, while Cache approved query strings is on.nirocache_max_query_copies— the most cached copies one page can have for approved query strings.nirocache_post_purge_urls— URLs cleared when a post changes.nirocache_site_wide_post_types— post types whose changes clear the whole cache.nirocache_commerce_paths— cart, checkout and account paths of other shops.nirocache_preload_urls— URLs to preload.nirocache_preload_spawn_cron— return false to stop NiroCache starting WP-Cron itself for preload batches.nirocache_optimize— return false to skip optimization for a page.nirocache_minify_html— return false to skip HTML minification.nirocache_html_keep_comments— HTML comments minification keeps.nirocache_excluded_cssandnirocache_excluded_js— assets optimization leaves alone.nirocache_defer_js_exclusionsandnirocache_delay_js_exclusions— scripts never deferred or delayed.nirocache_delay_js_timeout— how long delayed scripts wait before loading anyway.nirocache_preconnect_origins— origins to preconnect to.nirocache_conflicting_pluginsandnirocache_conflicting_optimizers— plugins to warn about.nirocache_dropin_path,nirocache_wp_config_pathandnirocache_htaccess_path— file locations NiroCache manages.
Actions:
nirocache_cache_created— a page was stored.nirocache_url_purged— a URL’s cached copies were cleared.nirocache_cache_purged— the whole cache was cleared.nirocache_network_purged— every site’s cache was cleared on multisite.nirocache_exclusions_changed— a page was ticked or unticked “Don’t cache this page”.nirocache_preload_startedandnirocache_preload_completed— a preload run started or finished.
Set the NIROCACHE_CACHE_DIR constant in wp-config.php to store cached pages somewhere else.
The admin screen is a React app. Its source is included in the plugin (spa/, package.json, webpack.config.js); build/ is compiled from it with yarn build.