
What Is Static Cache in WordPress? Faster Pages Without Rendering Every Request
Most WordPress performance advice starts after WordPress has already done its work. Compress the image. Convert it to WebP. Serve it from a CDN. Lazy load it. All of that matters. But there is another question that often gets ignored: Why is WordPress rebuilding the same page for every visitor?
A typical WordPress request loads the core, runs the active plugins, initializes the theme, queries the database, assembles the HTML, and sends it to the browser. For a logged-in editor, that work is necessary. For an anonymous visitor reading the same article as the previous thousand visitors, it usually is not.
Static cache removes that repeated work. This guide explains what static cache is, how it works, what it should never cache, and how the new LessFlux Static Cache feature fits into a WordPress performance strategy.
What Is Static Cache in WordPress?
Static cache means saving the finished HTML of a page and serving that saved copy to later visitors, instead of running WordPress again.
The first anonymous visitor requests a page. WordPress renders it normally, and the resulting HTML is stored as a file. The next visitor who requests the same URL receives the stored file. There is no theme rendering, no plugin logic, and no database query for that page.
That matters because the slowest part of many WordPress sites is not the network or the images. It is the time the server spends generating the HTML document before the browser receives the first byte.
Static cache is different from other kinds of caching you may already use:
- Browser cache stores files on the visitor’s device.
- Object cache (Redis, Memcached) stores database results so queries run faster.
- CDN cache stores files closer to the visitor.
- Static (page) cache stores the finished HTML so WordPress does not need to build it at all.
These layers complement each other. Static cache targets one specific bottleneck: the cost of generating the page.
Why Rendering Every Request Becomes a Bottleneck
WordPress is dynamic by design. That flexibility has a cost.
Every Visit Runs the Whole Stack
A single page view can involve the theme, a page builder, WooCommerce, an SEO plugin, a security plugin, several widgets, menus, and dozens of database queries. Each one adds a little time. Together they define your Time to First Byte.
Traffic Spikes Multiply the Cost
When ten visitors arrive, WordPress renders the page ten times. When a post gets shared and ten thousand visitors arrive, it renders the page ten thousand times. Slow responses, exhausted PHP workers, and timeouts often begin here.
Most Visitors See the Same Page
On a blog, a brochure site, or a documentation site, most anonymous visitors receive identical HTML. Rebuilding it each time is repeated work with no benefit.
How Static Cache Works
The process is simple to follow.
Step 1: An Anonymous Visitor Requests a Page
The request arrives for a public URL, such as /blog/my-article/.
Step 2: The Cache Checks Whether the Request Is Eligible
Not every request should be cached. The cache checks the request method, whether the visitor is logged in, whether the URL has a query string, and whether the page is on the exclusion list.
Step 3: The Page Is Rendered Once and Saved
If no cached copy exists, WordPress renders the page as usual. The finished HTML is saved to disk.
Step 4: Later Visitors Receive the Saved Copy
The next eligible request for the same URL is answered with the stored HTML.
Step 5: The Cache Is Cleared When Content Changes
When you update a post, delete a page, or edit a menu, the saved copies are cleared so visitors do not see outdated content.
What Static Cache Should Never Do
A page cache is only useful if it is careful. The most damaging cache bugs are not slow pages. They are wrong pages: a cart shown to the wrong person, or a logged-in dashboard shown to a stranger.
A fast page that shows the wrong content is worse than a slow page that shows the right one.
That is why a well-designed static cache skips several kinds of requests:
- Logged-in visitors. Editors, customers, and members always get the live page.
- Requests with a query string. URLs such as
?lang=enor tracking parameters are rendered normally. - Non-GET requests. Form submissions and other actions are never cached.
- Admin, AJAX, REST, cron, and feed requests. These are not public page views.
- Previews. Draft previews always reflect the current draft.
- WooCommerce cart, checkout, and account pages. These are personal by definition.
The goal is not to cache as much as possible. The goal is to cache what is safe to cache.
Static Cache vs. No Page Cache
| Without page cache | With static cache | |
|---|---|---|
| Work per anonymous visit | Full WordPress load, PHP, and database queries | Read a saved file |
| Effect on TTFB | Depends on theme, plugins, and hosting | Usually much lower for cached pages |
| Load during traffic spikes | Grows with every visitor | Mostly flat for cached pages |
| Logged-in visitors | Live page | Live page (never cached) |
| Content updates | Instantly live | Cache cleared automatically |
Results depend on your hosting, theme, and plugins. Measure your own site before and after, rather than trusting a universal number.
Introducing LessFlux Static Cache
LessFlux started as an external media optimization service. Images and videos are processed on LessFlux infrastructure, not on your server. Static Cache extends the same idea of taking unnecessary work off your WordPress installation.
It is built into the LessFlux plugin, so you do not need to install a separate caching plugin to get the basics.
Serve Saved Pages to Anonymous Visitors
Once enabled, logged-out visitors receive a saved copy of your pages instead of a freshly rendered one. The Cache screen shows a clear ACTIVE state, plus the number of cached pages and the total cache size.
Choose How Long Pages Stay Cached
The cache lifetime is a simple dropdown: 15 minutes, 1 hour, 6 hours, 12 hours, 24 hours, or Never. A shorter lifetime suits sites that change often. A longer one suits stable content.
Automatic Clearing When Content Changes
The cache is cleared when a post or page is saved, deleted, trashed, or restored, and when a menu is updated. You do not have to remember to purge it after every edit. A Clear Cache button is there when you want to do it by hand.
Exclude Specific URLs
Some pages should never be cached. You can list them on the Cache screen, one path per line, with * as a wildcard:
/contact/
/blog/*
You can also exclude a single page with one checkbox directly in the post, page, or product editor.
Safe Defaults for Personal Pages
Logged-in visitors, WooCommerce cart, checkout, and account pages, and any request with a query string are always skipped. Multilingual sites that use ?lang=en continue to work normally.
An Optional Fast Path
Normally, a cached page is served through WordPress hooks, after WordPress has started loading. LessFlux can also install a small advanced-cache.php drop-in. With the drop-in active, and WP_CACHE set to true in wp-config.php, cached pages are served before WordPress even loads. That is where static cache gives its biggest gain on TTFB.
If another caching plugin already owns advanced-cache.php, LessFlux does not overwrite it. Static Cache keeps working through the normal hooks, just without the extra speed, and the Cache screen tells you which mode you are in.
How to Enable LessFlux Static Cache
- Open the LessFlux plugin in your WordPress admin and go to Cache.
- Click Enable Static Cache.
- Choose a cache lifetime that matches how often your content changes.
- Add any URLs you want to exclude.
- If the screen asks for it, add
define('WP_CACHE', true);towp-config.phpfor the fast path.
Then test it. Load a page in a private window and compare the response headers. A page served from the drop-in includes the header X-LessFlux-Cache: HIT.
Things to Keep in Mind
Static cache is powerful, but it has limits worth knowing before you enable it.
Forms and Nonces
WordPress forms such as comments, login, and some contact forms embed a security nonce that stops working after roughly a day. If you cache pages that contain them, keep the cache lifetime short or clear the cache regularly. Otherwise visitors may see errors when they submit.
Do Not Stack Page Caches
Running several overlapping page-caching systems without understanding how they interact is a common cause of stale pages and confusing behavior. Use one page cache at a time, and let the others handle different layers such as CDN or object cache.
Highly Personalized Pages
If a public page shows content that differs per visitor, add it to the exclusion list.
Static Cache as Part of a Broader Strategy
Page cache is one layer, not the whole stack. A fast WordPress site usually combines several:
- Static cache to avoid rebuilding pages.
- Image and video optimization to shrink the heaviest assets.
- CDN delivery to bring files closer to visitors.
- Lazy loading to defer what is not needed immediately.
- Good hosting to keep uncached requests fast.
LessFlux covers several of these in one plugin, and the media work still runs externally. If you are working on server response time in particular, our guide on how to reduce TTFB in WordPress shows how to diagnose it first. For the architecture behind LessFlux media processing, read What Is External Media Processing?.
When Static Cache Makes the Most Sense
Static cache is a strong fit when:
- Most of your traffic is anonymous.
- Your pages are the same for every visitor.
- Your TTFB is high because of PHP and database work.
- Traffic spikes put pressure on your hosting.
It helps less when almost every visitor is logged in, or when most pages are personalized. Membership sites and dashboards are the usual examples.
Conclusion
Static cache answers a simple question: does this page need to be built again? For anonymous visitors on public pages, the answer is usually no.
LessFlux Static Cache serves saved pages to logged-out visitors, clears itself when your content changes, skips carts, logins, and query-string requests, and can run before WordPress loads when the optional drop-in is active. It lives in the same plugin that already handles your images and videos.
Your website should stay focused on serving visitors. LessFlux takes the repeated work off it. Do More With Less.
FAQ
What is static cache in WordPress?
It is a saved copy of a page’s finished HTML. Instead of running WordPress for every visit, the server sends the saved copy to eligible visitors.
Is static cache the same as page cache?
Yes, in practice. Both terms describe storing rendered pages and serving them without regenerating them.
Does LessFlux Static Cache work for logged-in users?
No. Logged-in visitors always receive the live page. Only anonymous visitors are served from the cache.
Does it work with WooCommerce?
Yes. Cart, checkout, and account pages are always excluded, along with any request from a logged-in visitor.
Will visitors see outdated content after I edit a post?
No. The cache is cleared automatically when a post, page, or menu changes. You can also clear it manually.
How long should I set the cache lifetime?
Shorter (15 minutes to 1 hour) for sites that change often or contain forms. Longer (12 to 24 hours) for stable content. “Never” keeps pages until the cache is cleared.
Why are pages with query strings not cached?
URLs with parameters, such as ?lang=en or tracking codes, can return different content for the same path. Skipping them avoids serving the wrong version.
How do I exclude a page from the cache?
Add its path on the Cache screen, with * as a wildcard, or tick the exclusion checkbox in the post or page editor.
What is the advanced-cache.php drop-in?
A small file that lets cached pages be served before WordPress loads. It gives the fastest response. If another caching plugin already uses that file, LessFlux does not replace it.
Can I use it with another caching plugin?
Technically yes, but avoid stacking two page caches. Keep one page cache and use other tools for different layers, such as CDN or object cache.
Does static cache replace a CDN?
No. A CDN delivers files closer to the visitor. Static cache avoids rebuilding the page on your server. They work well together.
Does the cache affect comment or contact forms?
Pages with WordPress forms contain a nonce that expires after about a day. Keep the lifetime short or clear the cache regularly on those pages.