WordPress Caching Explained: Page, Object, Browser and CDN

Use AI to summarise this article

Four different things get called caching in WordPress. They sit in different places and they help different visitors. Only one of them is what people mean when they install a plugin.

We added each layer to the same site, one at a time, and timed every request. The numbers below are ours.

The short version

Page cacheTook the home page from 0.084 s to 0.005 s. PHP did not run at all. It also refused to touch the cart or the search results.
Object cacheCut homepage queries from 105 to 4, a 96% drop, and took 12% off the time. Those two numbers disagree for a reason.
They do not add upOn a page cache hit nothing else runs, so the object cache underneath is never consulted.
Browser cacheWordPress sets none of it. Our stylesheets came back with no-cache on them, so the browser had to ask again every visit.
CDNSame page, 0.041 s from the edge and 1.425 s from the origin. Cloudflare’s own documentation says it does not cache HTML by default.
The one that bitesA stock page cache served one shopper’s page, cart notice and all, to two strangers who had added nothing.

Four layers, in the order a request meets them

A visitor’s request passes through each of these in turn. Any one of them can answer and stop the journey there.

Layer 1, on the visitor’s device

Browser cache

Files the visitor already downloaded once. Controlled entirely by the headers your server sends. Helps nobody on a first visit.

Layer 2, near the visitor

CDN cache

Copies held in a data centre close to them. Fast for everyone, including first-time visitors, but by default it holds your images and not your pages.

Layer 3, on your server, before WordPress

Page cache

A finished HTML file saved from an earlier visit. When it answers, WordPress never starts. The biggest single win, and the one with the sharpest edges.

Layer 4, inside WordPress

Object cache

Database answers kept in memory so WordPress does not ask twice. The only layer that helps on a page the other three refuse to hold.

Keep that order in mind. It explains almost every surprise in this article.

How we measured

One WordPress 7.1.3 install with WooCommerce and twelve plugins. A small must-use plugin logged every request: query count, query time, object cache hits, peak memory and PHP time.

Each time shown is the median of five requests. Five URLs: the home page, the shop, a product, the cart, and a search.

It is a local install, so the raw numbers are small. The shape of the result is what carries over to a real server.

The page cache: twenty times faster, on three pages out of five

With a file-based page cache running, the home page answered in 5 milliseconds instead of 84. The shop and the product page landed at 4 milliseconds.

Our logger recorded nothing for those requests. PHP never started, so there was nothing to log.

Grouped bar chart of median time to first byte for five WordPress URLs measured on one install with no caching, then with a persistent object cache added, then with a page cache added, showing the home page falling from 0.084 to 0.074 to 0.005 seconds and the cart page and search results staying near 0.09 seconds because the page cache skipped them

Look at the bottom two rows. The cart came back at 0.091 s and the search at 0.077 s. Both were slower than the home page was before we started.

Our logger caught PHP running on all five of those requests. The page cache had written exactly three HTML files, and neither of those URLs was among them.

That is not a fault. It is the design.

A page cache stores one answer and gives it to everyone. So it can only hold pages where everyone should see the same thing.

What the cache refuses, read from the source

Rather than trust the documentation, we read the plugin’s own exclusion routine. It skips a request when any of these is true.

// the request
not a GET          the response is not 200          DONOTCACHEPAGE is defined
an admin page      a feed, trackback or robots      a preview
a password-protected post                           a search
any query string outside a short tracking allowlist

// the visitor, matched against this one regular expression
/^(wp-postpass|wordpress_logged_in|comment_author)_/

// and the one that caught our own benchmark
an Accept header that does not contain text/html

That last line cost us an hour. Our first benchmark used plain curl, which sends Accept: */*, so every request bypassed the cache.

Nothing appeared on disk and PHP ran every time. The cache was working perfectly. Our test simply did not look like a browser.

If you benchmark your own site, send a browser Accept header and user agent, or you will measure the uncached path and conclude your cache is broken.

The shopper who handed their page to two strangers

Read that cookie regular expression again. It has three entries: a password-protected post, a logged-in user, and a comment author.

A guest who adds a product to a WooCommerce cart gets two cookies, woocommerce_items_in_cart and woocommerce_cart_hash. Neither is on that list.

So we tried it. One guest added a product, then two visitors with no cookies at all asked for the shop page.

Terminal output showing a WooCommerce guest adding a product and receiving the woocommerce_items_in_cart and woocommerce_cart_hash cookies, neither of which appears in the page cache plugin default bypass regular expression, after which two visitors with no cookies receive the shopper's cached shop page in nine milliseconds containing the notice banner, cart-frontend.js and a View cart link

PHP ran once, for the shopper. Both strangers got the stored copy in 9 milliseconds, byte for byte identical.

Their page carried the shopper’s success notice, the cart script and a View cart link. They had added nothing.

With the cache switched off, those two visitors genuinely do get different HTML. The shopper’s shop page is 7,726 bytes larger. The cache collapsed that difference into one file.

Nobody’s name or address leaked in our test. Put a cart total in the header and the same mechanism leaks more. A theme that greets a returning customer leaks more still.

This week they received emails from two customers saying that other peoples data was pre-filled in the checkout page. What the flipping heck?!? No credit card data was exposed, but full names and email addresses seem to be cached and displayed to other customers.

u/ZindaMe, r/Wordpress, February 2025

The failure runs the other way too. Cache a page while one shopper’s cart is empty. Serve it to a shopper whose cart is not, and their cart looks empty to them.

Instead, they see an error message: “Your cart is currently empty!”, while you can see it is not empty at all. […] Interesting thing is that when you are logged in user you don’t encounter this issue.

u/Woytek191, r/Wordpress, January 2025

Logged-in users escaped because their cookie is on the bypass list. Guests were not. That one regular expression explains the whole report.

The fix is one setting. Add your store’s cookies to the cache plugin’s bypass list, and exclude the cart, checkout and account pages by path. Then test as a guest with something in the basket, not as yourself.

The object cache: 96% fewer queries, 12% faster

WordPress already has an object cache. It keeps database answers in memory so WordPress never asks the same question twice in one request.

It is busier than people think. One uncached home page request served 2,441 cache hits against 209 misses.

Then it throws everything away. The official reference puts it bluntly. Cached data does not survive a page load unless you install a persistent caching plugin.

We installed one. The query counts fell off a cliff.

PageQueries beforeQueries afterTime saved
Home10540.010 s
Shop11580.008 s
Product135150.007 s
Cart12290.006 s
Search10960.016 s

A 96% cut in database queries bought 12% off the home page. That gap is the most useful number in this article.

Why your object cache disappointed you

Here is the reason, and it was sitting in the baseline all along. Those 105 queries took 5.7 milliseconds out of an 87 millisecond request.

The database was never the problem. Removing almost all of it could only ever win back those few milliseconds.

People hit this and reasonably conclude the advice was wrong.

I tested it using Redis, kept it running for several months. […] So really object cache while every guide will tell you to use it, in practice from my experience, doesn’t feel like a benefit.

u/Helpful_Client4721, r/Wordpress, January 2025

Their experience is real and their conclusion is too broad. An object cache pays for itself when the database actually is the bottleneck.

That means a big options table, slow queries, heavy plugins, or a store where every visit is personal. On a small mostly anonymous site, a page cache does more for less.

Measure your own ratio before you decide. If queries are a tenth of your request time, that tenth is your ceiling. The same arithmetic decides which of the usual suspects is costing you.

The layers do not stack the way diagrams suggest

Every explainer draws these as boxes inside boxes, as if each one shaves a bit more off.

They do not. The outer layer decides whether the inner one is ever reached.

On our page cache hits, PHP did not run. WordPress did not load. The persistent object cache we had just installed sat there untouched.

Somebody put this better than we can, in a thread about whether an extra cache plugin was worth it.

If 95% of requests don’t even need to go to your server (they are served directly from the Cloudflare data center closest to the user), any other caching on your server becomes a little moot because the request never even goes that far.

digitalpoint, WordPress support forums

So the question is never which cache runs fastest. It is which layer answers this particular request.

The browser cache, which WordPress does not set

This layer is a set of headers. Nothing more.

Terminal output of real HTTP response headers showing a plain WordPress home page with no Cache-Control header, a cart page with Expires set to 11 January 1984 and Cache-Control no-cache must-revalidate max-age zero private, a stylesheet with no-cache public must-revalidate, and a site behind a CDN sending public max-age zero with s-maxage 600 for HTML and max-age 315360000 for an uploaded image

Three things in there are worth a second look.

Our home page came back with no Cache-Control header at all. WordPress does not set one for a normal page, and it does not set one for your stylesheets either.

The cart page came back with Expires: Wed, 11 Jan 1984. That date is hard coded in wp-includes/functions.php, in the function WordPress uses to forbid caching. Core is telling every layer above it to keep its hands off.

Our stylesheets and scripts came back with no-cache on them. The browser had to revalidate every file on every visit. That is the web server’s default, and plenty of sites ship it for years.

Our own live site sets these headers properly. An image comes back with max-age=315360000 and an Expires date in 2037. The HTML carries public, max-age=0, s-maxage=600.

That single line is the browser cache and the CDN cache in one sentence. Nothing for the visitor’s browser, ten minutes for the shared cache in front.

The directive reference is worth ten minutes of anyone’s time, because every layer above WordPress obeys it.

The CDN, and the thing it will not do for you

We asked our own live site for the same page twelve times. Six went to the edge. Six carried a random query string, which forced a trip to the origin.

Edge: 0.041 s, 0.041 s, 0.096 s. Origin: 1.425 s, 1.485 s, 1.419 s.

Roughly thirty-five times the difference, on the same page, from the same laptop, within a minute.

Now the catch, in the provider’s own words. The Cloudflare CDN does not cache HTML or JSON by default. It decides what to hold by file extension, not by content type.

Point a CDN at a WordPress site and your images, CSS and fonts go to the edge. Your pages do not, until you write a rule.

Which is why this question comes up constantly.

One of the main reasons I bought it was the promised Cloudflare integration and full HTML caching, but so far, Cloudflare doesn’t show any hits on my test site.

u/easyedy, r/Wordpress, December 2025

And once the edge starts holding HTML, the cookie problem comes back one layer further out.

When I visit the site using Firefox (normal mode) and Edge or Chrome (safe/incognito modes), the response header cf-cache-status shows HIT […] However, when I use regular Edge or Chrome (normal mode), the cf-cache-status shows BYPASS

u/AyayaSUM, r/CloudFlare, June 2025

Their own header gave the answer: cf-apo-via: origin,cookie. A cookie in one browser and not the other, so one got the edge copy and one did not.

The fifth layer, which you are already using

OPcache belongs to PHP, not to WordPress. It keeps compiled PHP in memory so the engine skips re-reading your files on every request.

We asked our test server what it was doing. It had 3,103 scripts compiled and in memory, 307,116 hits against 3,119 misses, a 99.0% hit rate, using 98.4 MB.

Nobody installed it, nobody tunes it, and it was quietly doing more work than anything else on the list. Check that it is on. Then leave it alone.

Which layers your site actually needs

A blog or brochure site

Page cache and sensible browser cache headers. That is the whole job. An object cache will not show up in your numbers.

A shop

Page cache with your store cookies on the bypass list, plus an object cache. Carts, checkout and accounts can never use the page cache.

A membership or community site

Object cache first. Most of your visitors log in, which means the page cache skips most of your traffic.

An international audience

Add a CDN. It is the only layer that helps a first-time visitor on the far side of the world.

Nobody

Two page caches at once. WordPress allows a single advanced-cache.php drop-in, so the second one quietly loses. Then you spend a week wondering which settings page is lying.

That last rule has a sibling worth knowing. WordPress also allows one object-cache.php, which is why two object cache plugins fight.

Docket Cache cannot be used with other Object Caching plugins. By design, WordPress only allows one drop-in file at a time.

Nawawi Jamili, WordPress support forums

Those two files live in wp-content, next to your plugins folder. Looking at them tells you more in ten seconds than any settings screen.

Worth checking on a schedule, alongside the other quiet things that drift between updates.

$ ls wp-content/*.php
wp-content/advanced-cache.php   // a page cache is installed
wp-content/object-cache.php     // a persistent object cache is installed
wp-content/index.php

$ wp eval 'var_dump( wp_using_ext_object_cache() );'
bool(true)

Why your changes still do not show up

This is the daily cost of caching, and it has nothing to do with speed.

I manage around 200 WordPress sites for clients […] Almost daily I have to explain, again, why the change they made or requested doesn’t appear immediately due to caching layers. Even after explaining, many still assume it’s a bug or mistake

u/Tricky-Sky-4197, r/Wordpress, October 2025

Work outwards, not inwards. Clear in this order and stop as soon as the change appears.

1

Your own browser

Load the page in a private window. If it looks right there, nothing on the server needs touching and you can stop.

2

The page cache

Purge it for that one URL, not the whole site. A full purge on a busy site means every visitor pays for a rebuild.

3

The CDN

Purge the same URL at the edge. Our HTML is held for ten minutes, so a stale page can outlive a plugin purge.

4

The object cache

Flush it only if the content is still wrong after the first three. A flush here makes the next few requests slower, so it is a last step, not a first one.

Check the response header before you start guessing. cf-cache-status, x-cache or the plugin’s own signature comment will tell you which layer answered.

One more thing catches people out. A plugin update can quietly restore the default exclusions. It is the same trap as an update changing what you relied on.

Re-test your cart exclusions afterwards.

What twelve guides cover, and what they skip

We read every article ranking for this topic from December 2025 to October 2026. Twelve could be fetched in full and scored. Four refused to load or predated our two-year cutoff, so we left those out rather than guess.

Horizontal bar chart scoring twelve WordPress caching guides out of twelve, showing eight name the layer that helps logged-in users or the cart, five say the built-in object cache lasts one request, four mention OPcache, three explain what a CDN does not cache by default, two report their own measurement, two name the drop-in files, one warns a page cache can hand one visitor another visitor's page, and zero show a real response header, time each layer separately, or print the cookie list that decides the bypass

Eight of twelve correctly name the object cache as the layer for logged-in traffic. The explanations are mostly sound.

What is missing is anything you can check. None shows a real response header, and none times the layers separately.

None prints the cookie list that decides whether your shopper gets a cached page.

Two deserve credit. Maciej Nowak at Osom Studio walks the layers in request order and quotes Cloudflare’s HTML default.

Airlift carries the only plain warning in the set. Do not cache anything that could show one visitor another visitor’s information.

Not sure which layer is costing you?

We measure the request before we touch a setting. Where the time goes, which layer answers, what your cache quietly skips. Then we fix the one that matters.

See how our speed work runs

A store makes this harder. The pages that earn money are the ones no page cache will hold. That is a large part of what ongoing WooCommerce work involves.

Questions people actually ask about caching

Do I need a caching plugin if my host already caches?

Usually not, and running both can cause more trouble than it solves. WordPress permits a single advanced-cache.php drop-in, so two page caches cannot both win.

Check whether your host’s cache is answering by looking for a cache status header on a normal page. If it says HIT, you already have the layer that matters most.

Page cache or object cache, if I can only have one?

Page cache, for almost every site. Ours took the home page from 0.084 s to 0.005 s, and the object cache took it to 0.074 s.

Reverse that answer if most of your visitors log in. The page cache skips them entirely, so it has nothing to give.

Is Redis worth it for a small WordPress site?

Measure first. On our install the database was 5.7 ms of an 87 ms request, so removing 96% of the queries bought only 12%.

Redis is one storage option among several. The backend you choose matters far less than whether your queries were slow to begin with.

Will caching break my WooCommerce store?

It can, and the default settings are where it starts. We watched a stock page cache serve one shopper’s page to two visitors who had added nothing.

Exclude cart, checkout and account by path. Add your store cookies to the bypass list. Then test as a guest with a product in the basket.

Why does a CDN not speed up my pages?

Because it probably is not holding them. Cloudflare’s documentation says it skips HTML by default and decides by file extension.

Your images and stylesheets sit at the edge. Your pages do not. Holding HTML at the edge needs a rule, plus the same cookie care as a page cache.

How do I tell which cache served a page?

Read the response headers. A CDN usually adds its own status header. Most page cache plugins leave a header or a signature comment in the HTML.

Send a browser Accept header when you test. Plain curl defaults make some caches skip the request, which looks exactly like a broken cache.

My client says the site shows an old version. Where do I start?

Open the page in a private window first. If it looks right for you there, the problem is their browser, not your server.

Then purge outwards. That one URL in the page cache, the same URL at the CDN, and the object cache last.

Does caching help Core Web Vitals?

It helps the server part. Time to first byte feeds into largest contentful paint, and a page cache hit removes nearly all of it.

Layout shift and interaction delay come from your HTML, CSS and scripts. No cache will touch those.

Chat on WhatsApp