Skip to content

W3 Total Cache settings: the three modules to turn on, and what to leave off

A verified W3 Total Cache configuration for WordPress — enable Page Cache, Object Cache and Browser Cache, leave Minify, Database Cache and CDN off, and avoid double-caching against your host's Nginx FastCGI or LiteSpeed cache.

Turn on three of W3 Total Cache’s modules — Page Cache, Object Cache and Browser Cache — and leave the rest off until a measurement tells you otherwise. That is the whole configuration for most WordPress sites, and the reason is not minimalism: on a host that already runs an Nginx FastCGI cache or LiteSpeed cache, W3TC’s page cache becomes a second HTML cache in the same request path with its own separate purge logic, and most of the remaining modules either duplicate something the stack already does or rewrite your theme’s asset URLs in ways that break templates. This page covers the setup, the exclusions that keep carts and logged-in sessions out of the cache, and the commands that prove each module is actually doing work.

What you’ll accomplish

  • Establish whether the host already caches HTML before you enable a second page cache on top of it.
  • Configure Page Cache, Object Cache and Browser Cache using the setting names in the current W3TC interface rather than the ones a 2015 tutorial used.
  • Keep logged-in users, WooCommerce carts and checkout out of the page cache, and confirm the exclusions actually hold.
  • Prove each of the three modules is working: cache headers, the W3TC footer comment, the Redis keyspace, and curl -I on a static asset.
  • Have a written reason for every module you left off, so the next operator does not switch them on by reflex.

Prerequisites

  • W3 Total Cache 2.10.x — 2.10.5 is current as of August 2026, requires PHP 7.4 or later, and is tested against WordPress 7.1. Menu wording drifts between major versions; if a screen does not match, search the plugin’s own settings rather than assuming a rename.
  • SSH access with WP-CLI. W3TC registers the command as wp w3-total-cache, with wp total-cache and wp w3tc as aliases for the identical command set.
  • Write access to wp-config.php, to .htaccess on Apache or LiteSpeed or the site-root nginx.conf on Nginx, and to wp-content/.
  • A definite answer on whether the host runs its own HTML cache. Ask, then verify it yourself — it changes the most important decision on this page.
  • Redis or Memcached reachable from the web node. W3TC’s disk-backed object cache is usually worse than no persistent object cache at all.
  • A staging copy. Every setting below changes what real visitors are served.

How it works

W3TC is not one cache; it is a set of modules that each insert at a different point in the request path. Only three of those points are usually empty on a well-built host.

Page Cache with the Disk: Enhanced method writes finished HTML into wp-content/cache/page_enhanced/ under a per-host, per-path directory, and adds a rewrite block to .htaccess between the markers # BEGIN W3TC Page Cache core and # END W3TC Page Cache core. Apache or LiteSpeed serves that file directly and PHP is never started. The conditions in that block are deliberately strict — RewriteCond %{REQUEST_METHOD} !=POST, an empty-query-string condition, and a negated cookie match covering wordpress_logged_in, comment_author, wp-postpass and w3tc_logged_out — so anything that looks like a session falls through to PHP. The Disk: Basic method writes the same files but serves them through wp-content/advanced-cache.php, which means PHP does start on every hit; it exists for hosts where you cannot install rewrite rules.

Object Cache installs wp-content/object-cache.php and points WordPress’s object cache at Redis or Memcached instead of throwing it away at the end of each request. Repeated option, term and meta lookups come back from memory rather than MySQL. This is the module that helps logged-in traffic and wp-admin — exactly the traffic the page cache refuses to serve.

Browser Cache caches nothing on the server. It writes Expires and Cache-Control headers into .htaccess under # BEGIN W3TC Browser Cache so a returning visitor stops re-requesting assets already sitting in their browser.

Diagram of a WordPress request crossing six stages — browser, host edge cache, W3TC Page Cache, WordPress on PHP-FPM, W3TC Object Cache and MySQL — with the three minimum-viable W3TC modules marked at the stages where they act, a highlighted overlap between the host edge cache and W3TC Page Cache labelled as the double-caching risk, an anonymous request that stops at the W3TC page cache, and a logged-in request that traverses every stage to MySQL

The double-caching problem is the overlap in the middle of that diagram. If the host’s Nginx FastCGI or LiteSpeed cache already stores the HTML, W3TC’s page cache buys you a second copy of every page and a second thing to purge. When an editor updates a post, W3TC clears its copy; the host’s keeps serving the old HTML until its TTL expires. The symptom reads as “the cache won’t clear,” and the cause is two caches disagreeing about what is current.

Step-by-step

1. Find out what the host already caches. Do this before installing anything:

curl -sI https://www.example.com/ | grep -iE '^(x-cache|x-fastcgi-cache|x-litespeed-cache|x-proxy-cache|cf-cache-status|age):'
x-litespeed-cache: hit
age: 214

Any hit indicator here means an HTML cache is already in front of PHP. If you get nothing back, no edge cache is caching pages and W3TC’s page cache has a real job to do. Check the memory side too:

redis-cli ping
php -i | grep -E '^opcache.enable =>'

PONG means Redis is available for the object cache. The opcache line is informational — PHP’s opcode cache is a separate thing from anything W3TC does, and W3TC’s “Opcode:” engine choices refer to the long-deprecated APC/XCache data stores, not to OPcache.

2. Install the plugin and confirm which version you are configuring.

wp plugin install w3-total-cache --activate
wp eval 'echo W3TC_VERSION, PHP_EOL;'
ls -1 wp-content/w3tc-config/
2.10.5
master.php

W3TC keeps its settings in wp-content/w3tc-config/master.php, not in wp_options. On multisite you also get one numbered file per blog, such as 000002.php. Back that directory up before you start changing things — it is the whole configuration in one place.

3. Enable Page Cache, or deliberately do not. If step 1 showed an edge cache hit, skip this step entirely and leave Page Cache off. Otherwise, in General Settings, tick Enable under Page Cache and set Page Cache Method: to Disk: Enhanced. From the shell:

wp w3-total-cache option set pgcache.enabled true --type=boolean
wp w3-total-cache option set pgcache.engine file_generic
wp w3-total-cache fix_environment
Success: Option updated.
Success: Environment adjusted.

The fix_environment call is not optional. Setting options through WP-CLI does not rewrite .htaccess by itself — the plugin’s own help text says so — and without it the rewrite block never lands. Confirm both halves took:

grep -n "WP_CACHE" wp-config.php
grep -n "W3TC Page Cache core" .htaccess
82:define('WP_CACHE', true); // Added by W3 Total Cache
7:# BEGIN W3TC Page Cache core

On Nginx there is no .htaccess. W3TC writes its rules to nginx.conf in the site root and you have to include that file from the server block yourself, then reload Nginx. Nothing caches until you do.

4. Set the page-cache exclusions before you send traffic through it. This is where sites break. Don't cache pages for logged in users is on by default and should stay on. The Never cache the following pages: field, however, ships with only wp-.*\.php and index\.php, and Rejected cookies: ships with only wptouch_switch_toggle. W3TC does not exclude WooCommerce for you.

On the Page Cache screen, add your store’s dynamic paths to Never cache the following pages:, one per line:

/cart/
/checkout/
/my-account/
/wc-api/

And add the session cookies WooCommerce sets to Rejected cookies::

woocommerce_items_in_cart
woocommerce_cart_hash
wp_woocommerce_session_

While you are on that screen, leave Accepted query strings: alone unless you know what you are adding. That field is not a switch for caching query-string URLs — it is a list of parameters that get stripped from the cache key, and it already ships populated with roughly a hundred tracking parameters (utm_source, gclid, fbclid, msclkid, _ga and the rest). Entries there make the cache more effective, not less. Under Disk: Enhanced, any request that still carries a query string after that stripping bypasses the cache entirely.

5. Enable Object Cache on Redis. In General Settings, tick Enable under Object Cache and set Object Cache Method: to Redis. Then open the Object Cache screen and set the Redis host, port and database index — give each WordPress install on a shared Redis its own index so a flush on one site does not empty another’s cache.

wp w3-total-cache option set objectcache.enabled true --type=boolean
wp w3-total-cache option set objectcache.engine redis
wp cache type

The drop-in at wp-content/object-cache.php appears the moment the module is enabled, and wp cache type should now report something other than Default. Default lifetime of cache objects: is 180 seconds out of the box, which is conservative; raising it to 3600 is reasonable on a site whose content changes through WordPress rather than through direct database writes.

6. Enable Browser Cache. Tick Enable under Browser Cache in General Settings, then open the Browser Cache screen. Its three groups — CSS & JS, HTML & XML, Media & Other Files — want different treatment. For CSS & JS and Media & Other Files, tick Set expires header (the Expires header lifetime: default is already 31536000 seconds) and Set cache control header, then choose cache with max-age ("public, max-age=EXPIRES_SECONDS") for Cache Control policy:. Leave HTML & XML at its 3600-second lifetime; a long max-age on HTML makes visitors hold stale pages you cannot purge. To stop advertising the stack, untick Set W3 Total Cache header — that checkbox emits the X-Powered-By response header.

7. Leave every other module off, on purpose. Each one has a specific condition that would justify turning it on, and none of those conditions is “it sounds fast.”

Decision table listing every W3 Total Cache module — Page Cache, Object Cache, Browser Cache, Minify, Database Cache, CDN, Reverse Proxy, Cache Groups, User Experience and Purge via WP Cron — with its recommended default state of on or off and the specific condition that would justify changing that state

Database Cache deserves a specific note: it caches SQL query results, the same job Object Cache already does one layer higher and with better invalidation. Running both means every content change invalidates two stores, and on the disk engine it writes enough small files to cause real inode pressure on shared hosting. Minify deserves the other: it concatenates and rewrites theme and plugin asset URLs, and on any theme with conditionally-enqueued scripts the result is a page that looks fine on the homepage and broken three templates deep.

Validate it works

Confirm an anonymous request is served from cache and a logged-in one is not:

curl -sI https://www.example.com/ | grep -iE '^(cache-control|x-powered-by|content-encoding):'
curl -s https://www.example.com/ | tail -5

The tail of the HTML should end with a Performance optimized by W3 Total Cache comment, followed by a Served from: line naming the host and timestamp. That footer is the definitive proof W3TC handled the response — cache headers alone can come from the host’s own cache. Load the same URL in a logged-in browser session and view source: the footer should report the page was not served from the page cache.

Confirm the object cache is genuinely hitting Redis rather than silently falling back:

redis-cli info keyspace
wp cache set sh_probe hello && wp cache get sh_probe
# Keyspace
db0:keys=3184,expires=2907,avg_ttl=0
hello

A key count that grows as you browse is the signal. A db0 line stuck at zero while pages load means the drop-in is installed but Redis is not being written to — check the host, port and database index on the Object Cache screen.

Confirm browser-cache headers are reaching static assets:

curl -sI https://www.example.com/wp-content/themes/yourtheme/style.css | grep -iE '^(cache-control|expires|etag):'
cache-control: public, max-age=31536000
expires: Thu, 20 Aug 2027 09:14:22 GMT

Finally, prove the purge path works. Publish a change to a cached post, reload it anonymously, and confirm the new content appears. If it does not:

wp w3-total-cache flush all
Success: Everything flushed successfully.

Needing that command in normal operation is a finding, not a fix.

Troubleshooting

Content updates but the live page does not change. Two page caches are fighting. Check the response headers again for a host-level hit indicator. If the host caches HTML, turn W3TC’s Page Cache off — wp w3-total-cache option set pgcache.enabled false --type=boolean followed by wp w3-total-cache fix_environment — and let the host’s cache own the HTML. Trying to keep both in sync is a standing maintenance cost with no upside.

Carts empty themselves or every visitor sees the same cart. The page cache is serving a cached copy of a page that should be per-session. Add the WooCommerce paths and cookies from step 4, flush, and re-test with two separate browsers. Confirm Don't cache pages for logged in users is still ticked — some imported configurations arrive with it off.

Nothing is cached and the .htaccess block is missing. Either the file is not writable by the PHP user, or someone changed options through WP-CLI without running fix_environment. Run wp w3-total-cache fix_environment, then grep -c "W3TC" .htaccess. If the count is still zero, check ownership and permissions on .htaccess and on wp-content/.

The site breaks after enabling Minify. Turn it off first — wp w3-total-cache option set minify.enabled false --type=boolean — then wp w3-total-cache flush minify and hard-reload. Minify failures are rarely worth debugging on a site that already has a page cache; the remaining gain is small and the failure mode is a broken layout.

Disk usage climbs steadily on shared hosting. The page cache directory grows until garbage collection runs, and the default Garbage collection interval: of 3600 seconds relies on WP-Cron firing — which barely happens on a low-traffic site. Check with du -sh wp-content/cache/, then run wp w3-total-cache pgcache_cleanup to confirm collection works before assuming the setting is wrong.

When this is the wrong approach

If the host already runs LiteSpeed, the LiteSpeed Cache plugin talks directly to the server’s own cache and does the same job with one fewer moving part — see LiteSpeed Cache for WordPress on cPanel. If the host runs Nginx FastCGI cache with a working purge module, the correct W3TC configuration is object cache only; see setting up Redis object cache for WordPress for that half on its own.

W3TC is also the wrong tool when the real problem is not caching. A site whose uncached response time is four seconds has a query, plugin or theme problem, and a page cache only hides it from anonymous visitors while every logged-in editor keeps paying full price. Measure the uncached path first. And where nearly all traffic is authenticated — a membership site, an intranet — the page cache serves almost nobody, and the object cache is the only module here that will change anything.

Keep the plugin’s WordPress.org listing and BoldGrid’s support documentation open while you work; both track the current release rather than the version a given tutorial was written against.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.