Each time someone opens a page on a typical WordPress site, the server runs PHP, queries the database and assembles the HTML, then repeats the work for the next visitor even though nothing has changed. Website caching stops that repetition by keeping ready-made copies at several points between your server and the visitor’s screen.
Done well, it is one of the cheapest speed gains available. Done badly, it shows visitors yesterday’s prices, breaks forms or hands one customer another customer’s cart.
The short answer
- Website caching keeps a ready-made copy of a file, page or database result so it isn’t fetched or built again.
- Four layers matter: the browser cache on the visitor’s device, a CDN near the visitor, the page cache on your server and the object cache behind it.
- Cache what is the same for everyone. Never cache carts, checkouts, account areas, logged-in views or personalised content.
- You need a CDN when visitors are far from your server, spread across regions or arrive in bursts.
- Can’t see a change? An older copy is stored somewhere. Clear the caches from the server outwards.
The four layers of website caching
Each layer answers on your server’s behalf, and the closer to the visitor it sits, the sooner the page arrives.
| Layer | Where it lives | What it stores | How it’s cleared |
|---|---|---|---|
| Browser cache | The visitor’s device | Images, CSS, JavaScript, fonts | Expiry, or a new file address |
| CDN | Servers near visitors | Static files, sometimes whole pages | Purge in the CDN |
| Page cache | Your web server | Finished HTML pages | Purge in plugin or hosting panel |
| Object cache | Server memory | Database query results | Flush in the plugin |
Browser caching: the visitor’s own copy
On a first visit, the browser downloads your logo, stylesheets, scripts and fonts. Cache-control headers from your server tell it whether, and for how long, to keep them for later pages:
max-age=31536000keeps a file fresh for a year (the value is in seconds). Addingimmutablesays it won’t change while that copy is fresh, so the browser needn’t recheck it on a reload.no-cacheis widely misread. It allows storing, but the browser must check with the server before each reuse.no-storemeans keep no copy at all, andprivatekeeps a response out of shared caches such as a CDN.
The versioning rule. Long lifetimes are only safe when a file’s address changes whenever the file does. That is why WordPress adds a ?ver= number to theme and plugin stylesheets and scripts; it works as long as the number goes up with each change. The HTML page itself should get a short lifetime or no-cache, so visitors always receive the latest page.
Check it yourself. In Chrome DevTools, open the Network panel, make sure “Disable cache” is unticked and reload. Reused files show “(memory cache)” or “(disk cache)” in the Size column; click one to see its cache-control header.
Service workers go further, storing whole pages for offline use. That is progressive web app territory, which most business sites don’t need.
The CDN: copies near your visitors
What is a CDN? A content delivery network is a group of servers in many locations that keep copies of your content close to visitors. If the nearby server holds a fresh copy (a cache hit), it answers at once. If not (a miss), it fetches the file from your server, the origin, and keeps a copy.
Distance matters because opening a secure connection takes several round trips, and no server upgrade makes a trip across a continent shorter. CDNs work in two ways:
- Static files only. The CDN serves images, CSS, scripts and fonts, while your server still builds every page. Low risk, but the HTML still makes the long trip.
- Full-page caching. The CDN stores HTML too, so most visitors never reach your server. It gives the biggest cut in time to first byte, but needs rules to bypass logged-in visitors, carts and checkouts. Many CDNs only do this when you switch it on.
Page caching: finished pages on your server
A page cache stores each page’s finished HTML and serves it without running PHP or touching the database. Where most pages look the same to everyone, it is usually the biggest server-side gain, and the same hosting copes with far more visitors.
It can come from a caching plugin, your hosting or the CDN. Use just one: managed WordPress hosts that cache at server level often ask you not to add a plugin.
Two behaviours surprise owners. After a full purge the cache is cold, so the next visitor to each page waits while it’s rebuilt. And logged-in users usually bypass it, so a site can feel slow to its editors and fast to everyone else. How to speed up a WordPress website covers configuring it safely.
Object caching: fewer trips to the database
An object cache keeps database query results in memory (usually Redis or Memcached), so repeated requests skip the database. WordPress’s built-in object cache lasts for a single page load; a persistent one keeps results between requests.
It helps where page caching can’t: logged-in users, WooCommerce carts and checkouts, site search and large sites. On a small brochure site the gain is modest. It needs your host’s support, so ask about it when choosing web hosting for speed.
What must never be cached
Cache what is identical for every visitor. Never cache what belongs to one person or one moment:
Caches recognise these through URL exclusions, cookies and headers. WordPress sets a cookie starting wordpress_logged_in_ at login, and most caching plugins skip the cache when they see it. WooCommerce marks its cart, checkout and account pages as not to be cached.
The trap is at the edge. A CDN knows nothing about WordPress logins or carts unless you tell it. Set it to cache every page whatever headers your site sends, with no bypass rules for those cookies and paths, and it can serve one shopper’s cart to the next visitor. That is a privacy incident, not just a bug.
Also test for two quieter failures:
- Expired security tokens. Some forms embed a WordPress security token (a nonce) that, by default, expires 12 to 24 hours after it’s issued. Cache the page for longer than about 12 hours and the form can fail; keep lifetimes shorter or use forms that fetch a fresh token.
- Languages or currencies switched by cookie. Separate URLs per language cache cleanly. If a cookie switches language or currency on the same URL, the cache must vary on it, or visitors get whichever version was stored first.
Check it yourself. Add a product to a cart, then open the cart page in a private window: it must be empty. Submit a form on a page that has been cached for a day.
Do I need a CDN?
It depends on how far your visitors are from your server and how your traffic arrives.
| Your situation | How much a CDN helps |
|---|---|
| One main country, hosting in the same region, steady traffic | Modest for speed; side benefits may justify it |
| Visitors across several countries or continents | A lot, especially with full-page caching |
| Bursts from launches, press coverage or big email sends | A lot: cached pages absorb the peak |
| Hosting far from your audience, and moving isn’t practical | A lot |
| Mostly logged-in or personalised pages | Less for pages, still useful for files |
Check it yourself. See where visitors come from in Google Analytics, then measure time to first byte (TTFB) from those places with WebPageTest. PageSpeed Insights shows real visitors’ TTFB when Google has enough data, as reading PageSpeed Insights explains; Google’s web.dev suggests 0.8 seconds or less as a rough target. Good near your server but poor further away points to a CDN. Poor everywhere points to hosting and page caching first.
Side benefits and catches
- HTTPS handled for you. Many CDNs issue and renew TLS certificates automatically and support newer protocols such as HTTP/3.
- Protection against traffic floods. A large network can absorb traffic that would overwhelm one server, and basic denial-of-service protection is often included. It adds to, not replaces, the basics in the WordPress security guide.
- Less load on your hosting. Some CDNs can also keep serving cached pages while your server is briefly down.
The catches: a CDN is one more layer to configure, pay for and debug. Most whole-site CDNs need your domain’s DNS pointed at them, so plan it as carefully as a move to a new host. And encrypt the connection all the way to your server: if the CDN reaches your origin over plain HTTP while WordPress insists on HTTPS, you can get an endless redirect loop.
Why can’t I see my changes?
You save a page, but the old version still shows, for you or a colleague. A cache is serving an older copy; removing it is called purging.
How to clear your website cache, in the right order
Clear from the server outwards, because each layer refills from the one behind it. Purge the CDN first and it may fetch the stale page straight back from your page cache.
- Object cache, only if a menu, widget or setting change seems stuck.
- Page cache, in your caching plugin or hosting panel.
- CDN, for the changed URL, or everything after a design change.
- Your browser, with a hard reload (Ctrl+Shift+R, or Cmd+Shift+R on a Mac, in most browsers) or a private window. This only affects your own browser.
Symptom, likely cause, fix
| What you see | Likely layer | Fix |
|---|---|---|
| Change visible logged in, not in a private window | Page cache | Purge it, and check updates purge automatically |
| You see it, a colleague elsewhere doesn’t | Their browser or one CDN location | Hard reload, then purge the URL on the CDN |
| New text appears, new styling doesn’t | CSS cached at the same address | Make sure the file’s version number changes |
| A replaced image still shows the old one | Long cache on the image URL | Upload it under a new file name |
Prevention beats purging: a good set-up clears the edited page, and pages listing it, as you publish.
Frequently asked questions
Is a CDN the same as web hosting?
No. Hosting is where your site lives and its pages are built; a CDN sits in front and delivers copies. You still need an origin server, and a slow one still slows every cache miss.
Does website caching help SEO?
Indirectly. Caching mainly cuts server response time, which feeds into Largest Contentful Paint, one of Google’s Core Web Vitals. Google’s crawling documentation also says fast, stable server responses let it crawl more of a large site. Caching won’t make up for weak content, though.
Can I use two caching plugins at once?
No. Two page caches conflict and make faults hard to trace. Their extra features, such as minifying or delaying scripts, often break layouts, so switch those on one at a time and check key pages after each.
What to do next
A sound caching set-up for a typical business site:
The website speed optimisation guide shows where caching sits against images, scripts and hosting. Caching also drifts: a new plugin or an undocumented CDN rule can quietly stop pages being cached, or cache the wrong ones. Our website care plans keep WordPress updated and monitored, and the Growth plan adds monthly speed work, which is where caching checks belong.
Not sure whether your pages are served from cache, or whether a CDN would earn its place? Ask for a free website audit and tell us where your customers are, so the speed review reflects your real visitors.