The W3 Total Cache settings can be a bit daunting, especially with so many options at your fingertips. But fear not! This guide is here to help you sift through the myriad of configurations, ensuring your WordPress site runs at its peak performance.
1. W3 Total Cache Settings Setup Guide
Before diving into the settings, ensure that if you’re using an object cache (Redis or Memcached), it’s activated in your hosting account. This is typically found under ‘Select PHP Version’ → ‘PHP Extensions’ in cPanel. Once set, proceed with the W3 Total Cache setup guide.
- Object Cache
Ensure Redis or Memcached is activated in your hosting account. - Setup Guide
Open the guide and test page, database, and object cache. W3 Total Cache will indicate the fastest setting in green.
2. Dashboard
After setting up Cloudflare in the extensions settings and PageSpeed Insights in the general settings, their widgets will appear here. Most other elements are advertisements.
3. Feature Showcase
- Image Service: Activate if you plan to use W3 Total Cache for image compression and WebP conversion.
4. General Settings
Dive into the backbone of the W3 Total Cache configuration:
- Preview Mode
ON – Test settings without affecting your live site. Click “preview” to see changes and “deploy” when you’re satisfied. Remember to disable it when done. - Page Cache
ON – Reduces TTFB through page caching. - Page Cache Method
TEST – Use the setup guide to determine the best method. - Minify
ON – Shrinks the size of HTML, CSS, and JS files. If it causes issues, adjust the settings below and in the main “minify” tab. - Minify Mode
AUTO – If this disrupts your site, switch it to manual and specify CSS/JS files in the Minify settings. - Minify Cache Method
DISK – The recommended method in most cases. - HTML Minifier
MINIFY (DEFAULT) – Offers significant savings. - JS/CSS Minifier
JSMIN (DEFAULT) + MINIFY (DEFAULT) – Stick to the default in most scenarios. - Opcode Cache
OPCODE: ZEND OPCACHE – Ensure it’s enabled in your hosting account first. - Database Cache
- ON – Caches database queries.
- Database Cache Method
TEST – Use the setup guide to find the best method. - Object Cache
TEST – This can potentially slow down your site, so test thoroughly. - Object Cache Method
TEST – Again, refer to the setup guide. - Browser Cache
ON – Retains files in the user’s browser for quicker access. - CDN
- ON – Enable only if you’re using a CDN with a specific URL.
- CDN Type
GENERIC MIRROR – Recommended if using BunnyCDN. - Enable Reverse Proxy Caching Via Varnish
If using Varnish, specify the Varnish IP addresses. - Lazy Load Images
ON – Utilize W3 Total Cache for image lazy loading. - Disable Emoji
ON – Opt for Unicode for faster performance. - Disable wp-embed Script
If not required, turn it off. - Disable jquery-migrate On The Front-end
TEST – Disabling can boost performance but might disrupt your site. - Fragment Cache Method
OFF – Only enable if using W3TC Premium’s fragment cache. - License
For inputting your W3 Total Cache Premium license key. - Enable Google Page Speed Dashboard Widget
TEST – View PageSpeed Insights results directly in your W3TC dashboard. - Verify Rewrite Rules
ON – Alerts you of server configuration errors. - Enable File Locking
OFF – Typically not required for shared hosts. - Optimize Disk Enhanced Page And Minify Disk Caching For NFS
OFF – Generally, keep this off. - Fix Document Root Path
OFF – Only enable if the root path is misconfigured. - Anonymously Track Usage To Improve Product Quality
OFF – Opting out can slightly reduce CPU usage. - Debug Mode
OFF – Only turn on if you need to debug errors.
5. Page Cache
Page caching is like taking a snapshot of your pages, so they load faster for your visitors. Let’s set this up right:
- Cache Front Page
ON – Your homepage is the face of your site. Let’s make sure it loads quickly. - Cache Feeds
Site, Categories, Tags, Comments: ON – W3TC recommends this, and it ensures your feeds are snappy. - Cache SSL (HTTPS) Requests
ON – If you’ve secured your site with SSL (and you should), this is a must. - Cache URIs With Query String Variables
OFF – Unless your site uses specific query strings in URLs (like ?item=123), you can keep this off. - Cache 404 (Not Found) Pages
TEST – If you enable this, ensure your 404 pages are genuinely returning a 404 status. If they’re giving a 200 response, best to leave this off. - Don’t Cache Pages For Logged In Users
ON – Unless you have a membership site where logged-in users need a unique cached version, keep this on. If you do need it, you can specify which user roles see the cached version. - Cache Alias Hostnames
OFF – This is for caching content across different domains. It’s a niche setting and not typically recommended. - Automatically Prime The Page Cache
TEST – This pre-fills your cache, ensuring more visitors get a fast-loading page. If you enable it, provide your sitemap URL (like https://yourdomain.com/sitemap_index.xml). If you notice CPU spikes, adjust the update interval or pages per interval. Also, consider enabling the option to preload the post cache when you publish new content. - Purge Policy
The defaults here are solid. When you add new content, certain parts of your site (like your blogroll) should be refreshed to display it. The standard settings already handle this well. - REST API
TEST – Activate this and check your site. If everything’s smooth, great. If not, best to keep it off. - Advanced
This is for the pros. Here, you can exclude parts of your site from the cache or tweak settings like cache lifetimes. For most sites, the default settings here are just fine.
6. Minify Settings
Minification is like putting your website on a diet, trimming all the unnecessary bits to make it load faster. Let’s ensure we’re doing it right:
- Rewrite URL Structure
ON – This keeps your links looking clean and neat. - Disable Minify For Logged In Users
OFF – If you’ve enabled caching for logged-in users and they face issues, consider turning this on. Otherwise, keep it off. - Minify Error Notification
ADMIN NOTIFICATION – Stay informed about any minify errors right in your dashboard. You can also opt for email notifications if you prefer.
HTML Minify Settings:
- Enable: ON
- Inline CSS minification
ON – Keeps your inline styles lean. - Inline JS minification
ON – Trims the fat from your inline scripts. - Don’t minify feeds
ON – RSS feeds don’t need the minification treatment. - Line break removal
TEST – This can make your code more compact, but be cautious as it might disrupt your site. Activate, check, and deactivate if issues arise. - Ignored Comment stems
Specify any HTML comments you want to be left untouched during minification.
- Inline CSS minification
JS Minify Settings:
- Enable: ON
- Minify Method
MINIFY ONLY – Combining files can be tricky, especially for larger sites. Stick to just minifying. - Minify Engine Settings
TEST – Non-blocking settings can boost scores but might cause hiccups. Often, using “defer” before</head>
and default after<body>
works best. - Preserved comment removal
ON – Let’s get rid of those comments to slim down the file size. - Line break removal
TEST – Similar to the HTML setting, this can compact your scripts but might cause issues. - HTTP/2 Push
TEST – This can speed up the delivery of JS/CSS files to your visitors. Ensure your host supports it.
- Minify Method
CSS Minify Settings:
- Enable: ON
- Minify Method
MINIFY ONLY – For the same reasons as JS, we’re sticking to just minifying. - Minify Engine Settings
Refer to the JS settings above for guidance on comment and line break removal. - @import Handling
PROCESS – This ensures CSS files are imported correctly. - HTTP/2 Push
TEST – Just like with JS, this can speed up the delivery of your stylesheets.
- Minify Method
Advanced:
If minification causes any hiccups on your site, pinpoint the problematic files and exclude them here. If your CSS/JS files are pretty static, consider increasing the “Update external files every” number. For sites with high traffic, you might want to reduce the “Garbage collection interval”.
7. Database Cache
Sometimes, it’s best to trust the experts. In this case, the developer’s recommendation in the “Install” tab is to:
- Database Cache
Leave as is.
8. Object Cache
Again, the developer knows best. As per their guidance in the “Install” tab:
- Object Cache
Leave as is.
9. Browser Cache
Think of browser caching as teaching web browsers to remember your site, so they don’t have to ask for all the details every time. Let’s set this up:
- Set Last-Modified Header
ON – The documentation suggests this, and it’s a treasure trove of tips. Dive into it when you can. - Set Expires Header
ON for General, CSS & JS, and Media & Other Files. OFF for HTML & XML. This helps in serving static assets efficiently, but be cautious with HTML traffic. - Set Cache Control Header
ON – This nudges browsers to remember your files. - Set Entity Tag (ETag)
ON – A smart way to save bandwidth and prevent unnecessary overwrites. - Set W3 Total Cache Header
ON – This helps the plugin recognize optimized files. - Enable HTTP (gzip/brotli) Compression
If Brotli’s available (and it’s faster), go for it. If not, GZIP’s your friend. - Prevent Caching Of Objects After Settings Change
ON – This ensures browsers recognize updated assets. - Remove Query Strings From Static Resources
OFF – This is an old GTmetrix recommendation; you can safely ignore it. - Prevent Caching Exception List
Keep it empty unless you have specific query strings in mind. - Don’t Set Cookies For Static Files
ON – A neat trick to reduce traffic. - Do Not Process 404 Errors For Static Objects With WordPress
OFF – This ensures better plugin compatibility. - 404 Error Exception List
Keep it empty, given the previous setting. - Rewrite URL Structure Of Objects
OFF – No need to turn this on unless there’s a specific reason. - Expires Header Lifetime
Stick to the default. Google’s recommendation of 1 year for static assets aligns with this. - Security Headers
Add these for an extra layer of protection. You can test them at securityheaders.com or use the HTTP Headers plugin for an easier route.
10. Cache Groups
These settings let you fine-tune how different groups experience your site:
- User Agent Groups
This is for specifying mobile themes. If your site is mobile-responsive without a specific plugin, you can skip this. - Referrer Groups
This serves unique cache versions for users coming from specific sources, like Google. Most sites won’t need this. - Cookie Groups
Similar to referrer groups, but based on cookies. Again, most sites can leave this off.
11. CDN
When we talk about CDNs, we’re essentially talking about a network of servers that deliver your website’s content to users based on their geographical location. Think of it as a relay race, where the baton (your website’s content) is passed between runners (servers) to reach the finish line (the user) faster.
Now, not all CDNs are created equal. While Cloudflare is a popular choice, it doesn’t use a CDN URL. So, for this setup, we’re focusing on a combo: Cloudflare + BunnyCDN. Why? Gijo from WP Speed Matters and many in Facebook Groups vouch for it. While W3 Total Cache might nudge you towards StackPath, BunnyCDN outshines with more Points of Presence (PoPs) and consistent performance. Plus, BunnyCDN offers a better bang for your buck.
Setting Up BunnyCDN with W3 Total Cache:
- Activate Genetic Mirror
Head to W3 Total Cache General Settings and switch on Genetic Mirror. - Join BunnyCDN
Sign up for BunnyCDN - Create a Pull Zone
In your BunnyCDN dashboard, navigate to Pull Zones → Add Pull Zone. Name it after your domain (skip the HTTPS, WWW, or .com). Add your actual domain as the origin URL. Choose the regions you want to serve. Remember, some regions cost more, so be selective based on your audience. Hit “Add Pull Zone” to finalize. - Note Your CDN Details
BunnyCDN will display your pull zone name and CDN Domain. If you fancy, set up a custom CDN Domain likecdn.yourwebsite.com
. - Integrate with W3 Total Cache
Copy the CDN Domain and paste it in W3 Total Cache → CDN → Replace the site’s hostname with. The other settings can typically remain as they are. - Boost with BunnyCDN Plugin
Install the BunnyCDN plugin and input your pull zone name from step 4. This serves more assets via BunnyCDN, a tip straight from BunnyCDN’s support. - Fresh Start
Clear the cache in W3 Total Cache and purge the pull zone. - Verification Time
Ensure BunnyCDN is serving the right files by inspecting the image file paths.
12. Fragment Cache
Fragment Cache is a premium feature in W3 Total Cache, designed especially for dynamic sites like WooCommerce. It groups sections of your dynamic content, allowing you to control how each segment is cached. Think of it as a way to fine-tune your caching strategy for different parts of your content.
13. User Experience
Enhancing user experience is all about ensuring your website is responsive and visually appealing. Here’s how to optimize:
- Process HTML Image Tags
Turn this ON. It processes img tags for lazy loading, ensuring images load as users scroll. - Process Background Images
ON. This will lazy load background images found in CSS files. - Exclude Words
List images that appear above the fold here. Excluding them from lazy load can enhance the Largest Contentful Paint (LCP) metric. - Threshold
Adjust for a smoother scrolling experience. It pre-loads images before they appear on the viewport, preventing abrupt image loading. - Script Embed Method
Set to ASYNC. It’s the default and works well for most sites.
14. Install
This section doesn’t have settings per se, but it’s a treasure trove of tips from the developer. It’s also where you’ll find your rewrite rules.
15. Extensions
Activate extensions relevant to your site. For instance, if you’re using Cloudflare or an Image Service, ensure those extensions are active.
16. Cloudflare Integration
Cloudflare is a powerhouse for speed and security. Once you’ve set up Cloudflare, delve into the detailed tutorial on optimizing its settings. Here’s a step-by-step guide to integrating it with W3 Total Cache:
- Sign Up
Register on Cloudflare and add your website. - Change Nameservers
Modify nameservers in your domain registrar to point to Cloudflare. - Proxy Traffic
Ensure traffic is proxied through Cloudflare in the DNS settings. - W3TC Integration
Activate the Cloudflare Extension in W3 Total Cache and access its settings. - API Configuration
Input your Cloudflare email, API key, and zone in W3TC. - Optimize Settings
Adjust cache levels, Rocket Loader, Mirage, and other settings for optimal performance.
17. Image Optimization
While W3 Total Cache offers an image service for compression and WebP conversion, consider dedicated image optimization plugins or CDNs for more advanced settings. If you opt for W3TC’s service:
- Activate Image Service
Turn it on in the Extensions settings. - Configuration
Set preferences like lossless compression and auto-conversion. - WebP Conversion
Convert images to WebP format either manually or in bulk.
W3 Total Cache Best Settings Wrap-Up
Optimizing your WordPress site is a continuous journey, and tools like W3 Total Cache can significantly aid in that process. By fine-tuning settings, integrating with powerful platforms like Cloudflare, and choosing the right hosting, you can ensure your website is not only fast but also provides an exceptional user experience. Remember, every website is unique, so always test changes in a safe environment before deploying them live. Here’s to a faster, more efficient website!