WordPress Caching Setup Guide (2026): Page, Object, Browser and Edge Cache, Step by Step

WordPress caching setup: curl headers with Super Page Cache disk HIT behind Cloudflare, TTFB 0.684 s to 0.136 s

Disclosure: some links in this article (WP Rocket and FlyingPress) are affiliate links; read our affiliate disclosure. WPDeveloper gave us an xSpeed Cache Pro license for testing; they had no input into the results.

To set up WordPress caching, add four layers in order: a page cache plugin (finished HTML), an object cache with Redis if your host offers it (database results), long browser cache lifetimes for CSS, JS and images, and Cloudflare’s edge in front. Then preload the cache, exclude cart and account pages, and check the response headers.

  1. Check what your host already caches, so you don’t double up.
  2. Install one page cache plugin and turn on preload.
  3. Exclude pages that must never be cached (cart, checkout, account).
  4. Add a Redis object cache if you are on a VPS or a host that offers it.
  5. Give static files a one-year browser cache lifetime.
  6. Put Cloudflare in front, and decide whether it should cache HTML too.
  7. Verify every layer with response headers, then leave it alone.

I set up each layer on my own Nginx test site in November 2026 and measured it. With no cache at all, the test page took 0.684 s to start arriving (TTFB, from Dhaka). A plugin’s disk cache brought that to 0.289 s, Cloudflare’s edge to 0.136 s, and fixing browser cache lifetimes cut PageSpeed’s “cache lifetimes” warning from 231 KiB to 7 KiB. This WordPress caching setup guide walks through each step, with what changed and what to avoid.

Tested: WordPress 7.1.4, Kadence theme, Nginx on an aaPanel VPS in Hong Kong, Cloudflare proxied. Page cache with Super Page Cache 5.3.10, Jetpack Boost 4.8.2, WP-Optimize, xSpeed Cache 1.4.7 + Pro 1.3.8 and FlyingPress 5.6.7 (one at a time) and Redis for object cache. TTFB is the median of five curl runs from Dhaka; PageSpeed is mobile. November 10-12, 2026. Tested by Dolon Bepari. Method: how we test cache plugins.

The four layers of WordPress caching

Each layer stores something different in a different place, and each one fixes a different kind of slowness. Here is what each did on my server:

LayerWhat it storesWho it helpsWhat it did on my test page
Page cache (plugin or server)Finished HTML pagesLogged-out visitorsTTFB 0.684 s → 0.289 s (Super Page Cache disk cache)
Object cache (Redis)Database query resultsLogged-in users, WooCommerce, adminWorks under the page cache; mostly helps uncached requests
Browser cacheCSS, JS, images, fonts on the visitor’s deviceRepeat views and second pages“Cache lifetimes” warning 231 KiB → 7 KiB
Edge cache (Cloudflare)HTML and files near the visitorVisitors far from your serverTTFB 0.289 s → 0.136 s (Cloudflare HIT)

Two more caches work under the hood: PHP’s OPcache, which keeps compiled PHP in memory (most hosts turn it on for you), and your host’s own server cache, if it has one. The WordPress caching handbook covers those; the rest of this guide is about the layers you set up yourself.

Step 0: check what your host already caches

Before installing anything, look at the response headers of a page while logged out (curl -s -o NUL -D - https://yoursite.com/ on Windows, -o /dev/null on Mac/Linux). Headers such as x-cache, x-litespeed-cache or a host-named cache header mean your host already has a page cache; then you either use the host’s cache or its recommended plugin, not a second one. On my server nothing was caching yet: the only cache header was Cloudflare’s cf-cache-status: DYNAMIC, which means Cloudflare passed the HTML straight through from my server.

Step 1: set up a page cache

Install one page cache plugin and keep the defaults until you’ve measured. The page cache is the biggest win: the three plugins I measured against this baseline cut TTFB by 45 to 61 percent compared with no cache (0.684 s): 0.289 s for Super Page Cache, 0.267 s for Jetpack Boost’s page cache and 0.377 s for WP-Optimize (measured about 3 minutes after a purge, with its Delay JavaScript on). Which plugin to pick is covered in my best WordPress cache plugins test.

Settings that matter in almost every plugin: leave caching for logged-in users off, set a cache lifespan (Super Page Cache’s default was 0 and WP-Optimize’s 24 hours; check what yours means), and enable a separate mobile cache only if your theme serves different HTML to phones.

If your server runs Nginx

Nginx ignores .htaccess, so plugins that rely on it (WP Super Cache’s Expert mode, WP Fastest Cache) serve cached pages through PHP instead. That is still fast. W3 Total Cache and xSpeed Cache can hand cached pages straight to Nginx if you add their config to your server block. Measured from inside my server, xSpeed’s PHP path answered in 9.9-12.9 ms and its Nginx path in 6.5-7.8 ms; from Dhaka the difference disappeared in network time. So the Nginx fast path is nice, not essential. Details: best cache plugin for Nginx.

WordPress caching setup on Nginx: headers showing x-xspeed-cache HIT served by Nginx without PHP

Step 2: preload the cache

Turn on preload. Without it, the first visitor to each page after a purge or expiry waits for WordPress to build it, which on my page means roughly the uncached time (0.684 s) instead of 0.289 s. Most plugins have it: WP-Optimize preloaded automatically after a purge in my test, xSpeed’s Preloader warmed 5 of 5 pages per run, Super Page Cache preloads from your sitemap, and WP Rocket and FlyingPress have “clear and preload” buttons.

xSpeed Cache Preloader ready after warming 5 of 5 pages

Step 3: exclude pages that must not be cached

Some pages are different for every visitor and must never come from a page cache. WooCommerce’s own caching guidance lists Cart, Checkout and My Account, plus cookies such as woocommerce_items_in_cart and wp_woocommerce_session_. Membership pages, forms with one-time tokens and anything personalized belong on the same list. Most cache plugins already skip logged-in users and many exclude WooCommerce pages automatically; check the plugin’s exclusion box anyway.

xSpeed Cache expiry settings with excluded URLs

A classic symptom of a missed exclusion is a cart that shows someone else’s items, or a password-reset page that loops. If that happens, purge the cache and add the URL to the exclusions.

Step 4: add an object cache (Redis)

WordPress’s built-in object cache only lasts for a single request (WP_Object_Cache docs). To keep query results between requests you need a backend such as Redis plus a plugin or drop-in that connects WordPress to it: the free Redis Object Cache plugin, or the Redis option in W3 Total Cache, FlyingPress or xSpeed Cache. It mainly speeds up what the page cache skips: logged-in users, the admin, WooCommerce carts. On my test page xSpeed’s cached TTFB was about 0.23 s with Redis on; that’s a page-cache number, so don’t expect Redis to change logged-out speed much.

If several sites share one Redis server, give each its own database number or key prefix. On my server each site has its own database, and purging one site’s object cache took it from 478 keys to 47, while the other site’s database went from 16,715 to 16,713 keys, which is normal expiry, not the purge. Full setup: aaPanel Redis object cache.

Step 5: set browser cache lifetimes

Browser caching tells visitors’ browsers to keep CSS, JS, images and fonts, so the second page loads without downloading them again. You set it with long Cache-Control: max-age headers.

On Apache, most cache plugins write those rules to .htaccess. On Nginx they can’t: Super Page Cache’s browser caching toggle changed nothing on my server, and CSS stayed at the 12-hour lifetime from aaPanel’s default config. Setting expires 365d; in the Nginx config (and adding WebP, AVIF, SVG and font files to the image rule) took PageSpeed’s “Use efficient cache lifetimes” from 231 KiB of savings to 7 KiB. The full walkthrough is in how to leverage browser caching in WordPress.

aaPanel Nginx browser caching rules with expires set to 365 days for images, fonts, CSS and JS

One year is safe for CSS and JS in WordPress because file URLs carry a ?ver= number that changes when the file changes. Files without a version number (images, PDFs, CSS added by hand) stay cached for a year, so give a replaced file a new name. Don’t give HTML a long browser lifetime.

Step 6: add Cloudflare’s edge cache

Cloudflare’s free plan caches static files at its data centers but, by default, not your HTML (Cloudflare docs): that is why my baseline header said cf-cache-status: DYNAMIC.

To serve pages from the edge you need a Cache Rule that bypasses logged-in users and dynamic pages. Super Page Cache and FlyingPress can create that rule for you through the Cloudflare API; Cloudflare’s APO does it as a paid add-on ($5 a month on the free plan). With edge caching on, my TTFB went from 0.289 s (disk cache) to 0.136 s with Super Page Cache, and FlyingPress’s rule (with its full setup) gave 0.146 s.

Super Page Cache headers showing cf-cache-status HIT from Cloudflare's edge

My Cloudflare settings for WordPress are in this guide, and what each status value means is in cf-cache-status explained.

Do you still need a cache plugin with Cloudflare?

Yes, in most setups. With default settings Cloudflare doesn’t cache your HTML at all, so every page view still runs WordPress on your server; a page cache plugin is what makes that fast.

Even with HTML cached at the edge, the first request after a purge or an expiry, and the first visit through each Cloudflare data center, goes back to your server. A page cache keeps those fast. Logged-in users bypass both caches; that is where Redis helps. The only case where you can skip the plugin is when your host or Cloudflare APO already caches HTML and handles purging when you publish.

Delay JavaScript: the setting next to caching

Delay JavaScript isn’t caching, but it lives in the same plugins and you’ll meet it during setup. It holds scripts back until the visitor scrolls, clicks or types. On a heavy page it can help a lot; on my light test page the score barely moved, though Speed Index dropped sharply in that run.

FlyingPress’s basic setup scored 98 (LCP 1.8 s, Speed Index 3.7 s); turning on Delay JavaScript gave 100 (LCP 1.7 s, Speed Index 1.1 s). In xSpeed, adding Delay on top of its recommended setup (page cache, Nginx snippet, Turbo Render, Preloader, Redis) kept the score at 100 and moved LCP from 1.5 s to 1.4 s; Total Blocking Time was already 0. For the parts of LCP that caching does not touch, such as images, fonts and render-blocking CSS, see my LCP guide for WordPress.

Two cautions. PageSpeed’s test never clicks or scrolls, so a “load after interaction” mode can look better in the score than it feels to a real visitor.

And delaying the wrong script can break menus, sliders or forms, so click around after enabling it and exclude what breaks (xSpeed, for example, leaves jQuery out of the delay). Defaults differ: it was off when WP Rocket was activated on my site, while FlyingPress switched it on by itself. And not every plugin offers it for free: Super Page Cache keeps it in Pro, Jetpack Boost’s free plan doesn’t have it, and on NitroPack’s free plan Delayed scripts is locked to the Plus plan.

How to check that every layer works

LayerWhat to checkWorking looks like
Page cacheResponse header, second requestx-flying-press-cache: HIT, wpo-cache-status: cached, x-xspeed-cache: HIT
Object cacheredis-cli INFO keyspace or the plugin’s status screenKey count rises as you browse
Browser cacheHeaders of a CSS or image filecache-control: max-age=31536000
Edge cachecf-cache-status on an HTML pageHIT on the second request, with an Age header

Always test logged out, in a private window or with curl. More tests are in how to check if WordPress cache is working, and the purge order is in how to clear WordPress cache.

For a quick outside check, our free WordPress cache checker lists the plugin, server and Cloudflare layers separately, and the TTFB checker compares cached and uncached time.

Common WordPress caching mistakes

  • Two page cache plugins at once. They fight over advanced-cache.php. Remove one completely first; my advanced-cache.php guide lists what each plugin left behind.
  • A leftover define('WP_CACHE', false); line from an old plugin, which stops the next one from caching.
  • Caching logged-in users or the cart. Leads to people seeing each other’s data.
  • Purging Cloudflare before the plugin. Cloudflare re-caches the old HTML. Clear from the inside out.
  • New combined CSS/JS files behind Cloudflare. With Jetpack Boost’s Concatenate CSS, Cloudflare stored a 404 for the new files on my site and the design broke until I used Purge Everything.
  • Judging by one PageSpeed run. Don’t trust a single run; repeat it and compare TTFB from the same place.

FAQ

What is the best caching setup for WordPress?

One page cache plugin with preload, Redis object cache if your host supports it, one-year browser cache lifetimes for static files, and Cloudflare in front. On my test site that took TTFB from 0.684 s with no cache to 0.289 s with a disk cache and 0.136 s from Cloudflare’s edge.

Which caching is best for WordPress?

Page caching makes the biggest difference for most sites, because it skips PHP and the database for logged-out visitors. Object caching (Redis) helps logged-in users and WooCommerce, browser caching helps repeat views, and edge caching helps visitors far from your server.

Should I use a caching plugin with Cloudflare?

Usually yes. Cloudflare doesn’t cache HTML by default, so pages still come from your server, and a page cache plugin makes those requests fast. Even with HTML cached at the edge, the first request after a purge or expiry still reaches your server, and the plugin makes that fast.

Do I need Redis object cache for WordPress?

Not for a small blog with mostly logged-out visitors; the page cache does most of the work. It helps when many requests can’t be page-cached: WooCommerce carts, membership sites, busy admin areas. It needs a Redis server, so it’s usually a VPS or managed-host feature.

Which pages should not be cached in WordPress?

Cart, checkout and account pages on WooCommerce, anything personalized for logged-in users, and pages with one-time form tokens. WooCommerce also lists its session and cart cookies as reasons to bypass the cache.

Is Delay JavaScript part of caching?

No. It’s a file optimization setting that cache plugins include, which holds scripts back until the visitor interacts. On my light test page it moved PageSpeed from 98 to 100 with FlyingPress, but test menus and forms after enabling it.

How long should WordPress cache last?

For HTML pages, hours to a day, with preload refilling the cache. For static files in the browser, one year is standard because WordPress adds a version number to CSS and JS URLs. Purge when you publish or change the design.

Related Guides