WordPress Caching Explained

Category: WordPress Hosting ยท Updated 2026-11-09

WordPress caching stores a ready-made copy of a page or piece of data so the site does not have to rebuild it from scratch, including PHP processing and database queries, for every visitor. The main layers are page cache (full HTML pages), object cache (database query results) and browser cache (files stored on the visitor's own device), and most fast WordPress sites use a combination of all three.

Why WordPress needs caching

Without caching, WordPress rebuilds each page from scratch on every visit: PHP runs the theme and plugin code, and the result usually depends on several database queries to pull in post content, menus, widgets and settings. That process is fast for one visitor but adds up quickly under real traffic, since the server repeats the same work for every single request even when the page has not changed.

The main caching layers

LayerWhat it storesWhere it lives
Page cacheA complete, pre-rendered HTML pageServer disk or memory
Object cacheResults of repeated database queriesMemory, often via Redis or Memcached
Opcode cacheCompiled PHP code, skipping re-parsing on every requestServer memory, via OPcache
Browser cacheStatic files like images, CSS and JavaScriptThe visitor's own device
CDN cacheCopies of pages or assets served from edge locationsA content delivery network, closer to the visitor

Page cache: the biggest speed win

Page caching saves the final HTML output of a page the first time it is generated, then serves that saved copy to every later visitor who requests the same page, skipping PHP execution and database queries almost entirely. This is usually the single largest performance improvement available to a typical WordPress site, which is why most hosting-provided caching and popular plugins such as WP Super Cache or W3 Total Cache start here.

Object cache and why it matters for logged-in users

Page cache normally only serves logged-out, non-personalized visitors, since a cached page would otherwise show the wrong user's data. An object cache, commonly backed by Redis or Memcached, instead caches the results of individual database queries. This speeds up dynamic requests that cannot use the page cache, such as the WordPress admin area, logged-in membership pages, or WooCommerce carts, because repeated queries for the same data are served from memory instead of hitting the database again.

When caching causes problems

  • A page cache that is not cleared after editing content can show visitors an outdated version of the page.
  • Caching logged-in or cart pages by mistake can leak one visitor's session data to another.
  • Form submissions and checkout pages usually need to be excluded from page caching entirely.
  • Aggressive minify or combine settings, often bundled with caching plugins, can occasionally break theme or plugin JavaScript.
  • Running two full-page caching plugins at once, or a plugin's cache fighting with a host's server-level cache, can cause unpredictable results.

Frequently asked questions

What is the difference between page cache and object cache in WordPress?

Page cache stores a complete, ready-to-serve HTML page and is used mainly for logged-out visitors. Object cache stores the results of individual database queries and speeds up dynamic pages, including the admin area and logged-in sessions, where a full page cannot be reused as-is.

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

Not always. Many managed WordPress hosts include server-level page caching and sometimes object caching built in, which can conflict with a plugin doing the same job. Check with the host before adding a separate caching plugin on top.

Why does my WordPress site show old content after I edit it?

This is usually a caching issue: a page cache, a CDN cache, or the visitor's own browser cache is still serving an older saved copy. Clearing the relevant cache, or waiting for it to expire, resolves it once the new version is saved again.

Can caching break a WordPress login or checkout page?

Yes, if those pages are accidentally included in the page cache, since a cached copy can show one visitor's session or cart to someone else. Properly configured caching plugins exclude logged-in sessions, carts and checkout pages from page caching by default.

What is OPcache and is it different from page caching?

OPcache is a PHP-level cache that stores compiled PHP code so the server does not have to re-parse the same script files on every request. It works beneath page and object caching and speeds up all PHP execution, not just WordPress.

Does a CDN replace the need for WordPress caching plugins?

A CDN mainly caches static files and, in some setups, full pages at edge locations close to the visitor, which reduces load on the origin server. It complements rather than replaces object caching for logged-in or dynamic requests that still need to reach the server.

Related topics