WordPress Caching Explained: Page, Object, Browser and CDN Caches
Caching is the biggest speed lever for WordPress, but the term covers several layers. Learn what each cache does, how they combine and what can go wrong.
Caching is the most effective way to speed up most WordPress sites, but it is also confusing because the word describes several different things. Page cache, object cache, browser cache, opcode cache and CDN cache all save work in different places. Understanding the layers helps you configure them properly and avoid the classic problem of changes that do not show up.
Why WordPress needs caching
WordPress builds each page dynamically. For every request, PHP loads WordPress, your theme and plugins, queries the database, assembles the HTML and sends it. That is flexible but takes time and server resources. Caching saves the result of that work so it does not have to be repeated for the next visitor.
The layers of caching
Opcode cache
PHP code is compiled before it runs. An opcode cache keeps the compiled version in memory, so files are not recompiled on each request. It is a server feature and is usually enabled by the host. You rarely configure it yourself.
Object cache
WordPress can store the results of database queries and other computed data. By default, this lasts only for one request. With a persistent object cache backed by a memory store, the data survives between requests. It helps dynamic sites most, such as shops, membership sites and busy admin areas. It needs server support, so ask your host if it is available.
Page cache
A page cache saves the final HTML of a page and serves it directly, skipping PHP and the database for most requests. This is the layer that usually makes the largest difference to response time on content-heavy sites. It can run inside WordPress through a plugin, or at the server level, which is faster still.
Browser cache
Browser caching tells visitors' browsers to keep static files such as images, CSS and JavaScript for a period. On repeat visits and later pages, those files do not need downloading again. It is controlled by cache headers that a plugin or server config sets.
CDN cache
A content delivery network stores copies of your static files, and sometimes full pages, on servers closer to visitors. It reduces distance and takes load off your hosting server. Our CDN page explains how Cloudflare works with sites hosted with us.
How the layers work together
| Layer | What it saves | Where it lives |
|---|---|---|
| Opcode | PHP compilation | Server memory |
| Object | Database query results | Server memory |
| Page | Finished HTML | Disk or server memory |
| Browser | Static files | Visitor's device |
| CDN | Static files, sometimes pages | Edge servers worldwide |
A request may be satisfied at any layer. The closer to the visitor, the faster it is. When one layer misses, the next handles it.
Setting up caching sensibly
- Choose one page caching solution. Using two at once, such as two plugins, causes conflicts.
- Enable page caching and compression, and set a reasonable cache lifetime.
- Exclude pages that must stay dynamic: cart, checkout, account pages and anything personalised.
- Enable browser caching for static files.
- Add a CDN if your visitors are spread out geographically.
- Consider an object cache if your site is dynamic and your host supports it.
What to exclude from caching
- Logged-in users, in most cases, unless your solution handles it carefully.
- Pages with forms that include security tokens, unless the plugin handles refreshing them.
- Search results and URLs with unusual query strings.
- Any page where each visitor sees different content.
Common caching problems
Changes do not appear
You updated a page, but visitors still see the old one. Purge the page cache, then the CDN cache, and test in a private browser window. Good caching plugins clear relevant pages when you update content; if yours does not, check its settings for automatic purge rules.
Broken layout after minifying
Combining and minifying CSS and JavaScript can break scripts. Enable such options one at a time and test. Often the gains are small, and the risk is not worth it.
Wrong content shown to the wrong visitor
This happens when a personalised page is cached. Fix the exclusions immediately and purge everything.
Cached error pages
If a temporary error got stored, visitors keep seeing it until the cache is purged. Clear the caches after resolving the underlying problem.
Caching and testing
When you test performance, be aware of whether you are measuring a cached or uncached page. The first request after a purge is slower, and later ones are fast. To check that caching works, look at response headers, which many plugins and CDNs mark as hit or miss, and compare timings on repeated requests.
Cache and security
Caching also interacts with security. Never cache pages that contain personal data, and make sure your cache plugin does not store the admin area. If you use a CDN to cache full pages, check how it treats cookies, since logged-in visitors and customers with items in a cart should bypass the cache. When in doubt, test with two different browsers, one logged in and one anonymous, and compare what each sees.
Caching with Zebra Hosting
Our WordPress hosting includes Plesk, free SSL and Cloudflare CDN availability on hosted sites. If you are not sure which caching layers suit your site, our support team can help, and the knowledgebase covers common setups.