Setting Up Caching in WordPress the Right Way

8 min read Auf Deutsch lesen

Caching is the single most effective lever for a fast WordPress site – and the most misunderstood. “Just install a cache plugin” falls short, because caching happens on several layers. Once you know the layers, you make the right decision instead of stacking three overlapping plugins that get in each other’s way.

What Caching Actually Does

WordPress rebuilds every page on every request: PHP runs, the database is queried, HTML is generated, the result goes to the browser. This assembly costs time – visible as a high Time to First Byte (TTFB), the moment until the server sends the first byte. Caching stores the result so the next request serves the finished version, without all that work. This mainly lowers the TTFB and with it the LCP noticeably – and relieves the server during traffic spikes.

The Layers, from Outside In

1. Page Cache (the finished HTML)

The biggest impact. The complete page is cached as static HTML. There are two routes:

  • Server caching (e.g. via the web server or a reverse proxy like Varnish or the Nginx FastCGI cache). The fastest option, because PHP never even starts – the server delivers the stored file directly. If your hosting offers it: first choice.
  • Plugin caching (a WordPress plugin generates static files). A solid alternative when no server cache is available. Not both in parallel – that causes conflicts and display glitches.

2. Object Cache (database results)

Stores recurring database queries in memory (Redis or Memcached). Especially valuable for dynamic, logged-in areas and for WooCommerce, where the page cache deliberately steps aside. On a small blog it does little; on a shop it’s one of the biggest levers.

3. Browser Cache (static files at the visitor)

Images, CSS and JavaScript are cached in the visitor’s browser. This is controlled via cache headers (Cache-Control, Expires). The effect: returning visitors and users moving between pages don’t re-download these files but load them from their local storage.

Excluding the Cache Correctly

The most common caching mistake isn’t a missing cache but a misapplied one. These areas must never be served statically:

  • Cart, checkout and account in WooCommerce – otherwise one customer sees another’s cart.
  • Logged-in areas – membership pages, client portals, the admin backend.
  • Form and preview pages with personalised or session-dependent content.

A good cache recognises the relevant WooCommerce and login cookies and bypasses these pages automatically. After setup, always check that login and checkout work cleanly – ideally once as a logged-in user and once in a private window.

The Typical Mistakes

  • Several cache plugins at once – they override each other and cause hard-to-trace display glitches.
  • Not excluding the cache where needed – see above; personalised pages never belong in the page cache.
  • Panic after every change – modern caches clear themselves on content changes; only clear deliberately when you see stale states.
  • Caching as a substitute for cleaning up – a cache hides an overloaded page, it doesn’t heal it. Too many plugins and a bloated database remain a problem.

When Caching Alone Isn’t Enough

Caching speeds up delivery, but it doesn’t replace a clean foundation. If a page loads 40 plugins, serves huge unoptimised images or runs on a bloated database, the cache only masks that for the first impression. The first, uncached request – and Google’s crawler gets one too – stays slow. Caching therefore belongs together with optimised images, a lean plugin selection and a tidy database.

A Sensible Order

  1. Check whether your hosting offers server caching – if so, enable it there.
  2. If not: one established cache plugin, not several.
  3. For WooCommerce or many logged-in users, add an object cache (Redis).
  4. Have browser cache headers set (often part of the cache or via .htaccess).
  5. Check login and checkout, then measure the Core Web Vitals.

Not sure which cache layer actually helps your setup? Drop us a line – we’ll set up caching cleanly, without cart or login getting muddled.

Frequently Asked Questions

Do I even need a cache plugin?

Not necessarily. If your hosting ships a server-side page cache (for example via Nginx FastCGI or Varnish), it's faster than any plugin because PHP never even starts – a separate cache plugin is then superfluous and can even cause conflicts. Only when no server cache is available does a single, established cache plugin take over the job.

Server cache or plugin cache – which is better?

Server caching is the better choice when your hosting offers it: the finished page is served without PHP and the database even starting up. Plugin caching generates static files inside WordPress and is a solid alternative when there's no server cache. Important: never run both in parallel, as that leads to contradictory states and hard-to-trace display glitches.

What is an object cache and when do I need it?

An object cache (Redis or Memcached) stores the results of database queries in memory so WordPress doesn't re-run the same query on every request. It works mainly where the page cache doesn't reach: in logged-in areas, with WooCommerce and on heavily dynamic pages. For a small blog it's usually unnecessary; for a shop it's almost mandatory.

Do I have to clear the cache manually after every change?

Usually not. Modern caches detect content changes and clear the affected pages themselves. You should only clear manually if you still see a stale state despite a saved change – for example after direct edits to templates or CSS. Clearing constantly makes the cache pointless.

Daniel Nilges
Daniel Nilges

Founder & Full-Stack Developer

20+ years of web development experience. Specialised in Laravel, WordPress and custom software for mid-sized businesses.