Looking for the best W3 Total Cache settings?
I generally don’t recommend W3 Total Cache since it doesn’t support database cleanup, heartbeat control, optimizing Google Fonts video optimization, or NGINX + memcached (only available with the premium version). While W3 Total Cache is free, WP Rocket is better since it has these built-in. That’s why it yields faster load times and is rated the #1 cache plugin in most Facebook polls. But if you insist on free, use this tutorial to set up your W3 Total Cache settings.
This tutorial shows you how to set up the performance tabs then add Cloudflare’s free CDN or BunnyCDN‘s premium CDN. Many W3 Total Cache settings are preset (shown in the “Install” tab), but not all of them. For hosting, I recommend DigitalOcean on Cloudways especially over SiteGround, EIG, and GoDaddy (TLDR: Cloudways + WP Rocket is a much faster configuration). They’re what I use; see my GTmetrix report or click through my posts to see how fast they load.
- General Settings
- Page Cache
- Database Cache
- Object Cache
- Browser Cache
- User Agent Groups
- Referrer Groups
- Cookie Groups
- Fragment Cache
- User Experience
Download my recommended W3 Total Cache settings here (you’ll need a Dropbox account). Upload the file under Performance → General Settings → Import / Export Settings. Check your site to make sure everything is OK. You will still need to configure a CDN, activate extensions, and add your sitemap URL (under Page Cache). This file was last updated on March, 18, 2019.
1. General Settings
Important notes about the W3 Total Cache general settings:
- Cache method: use disk enhanced for shared hosting, memcached for cloud hosting.
- Database cache: leave disabled, it overloads the server especially on shared hosting.
- Object cache: leave disabled, it will usually slow down the website and the dashboard.
- CDN: enable if you plan on using BunnyCDN or another CDN (disable for Cloudflare).
- Lazy loading: delays loading of images and fixes the lazy load item in PageSpeed Insights.
- Fragment cache: only available with W3 Total Cache Pro and usually for dynamic sites.
- Google PageSpeed Widget: I recommend the GTmetrix plugin for monitoring instead.
2. Page Cache
Important notes about the W3 Total Cache page cache settings:
- Don’t cache pages: you don’t want to cache pages for logged in users or user roles.
- Rest API: the rest API can be disabled if you’re not using (check your website for errors).
- Compatibility mode: enable, this is recommended in the Install tab by the developer.
3. Minify Settings
The plugin developer says the recommended settings for minify, database, and object cache are preset. You can find these recommendations in the Install tab. The main things to tweak are the browser cache settings and set up a content delivery network like Cloudflare or BunnyCDN.
4. Database Cache
- Leave as is (recommended by the developer).
5. Object Cache
- Leave as is (recommended by the developer).
6. Browser Cache
Important notes about the W3 Total Cache browser cache settings:
- Enable first 6 settings: enable these individually and test the results in GTmetrix.
- Brotli compression: if using Cloudflare’s CDN, enable this in the Cloudflare dashboard.
Leave everything else including ‘expires header lifetime’ which the developer says is preset.
7. User Agent Groups
User Agent Groups are used to specify whether a mobile theme is used (if you have a mobile responsive website and are not using a plugin to create a mobile site, there is no need for this).
8. Referrer Groups
Referrer Groups are used to serve a unique cached version for users who come to your site through specific traffic sources (eg. Google or Bing). Most websites should leave this disabled.
9. Cookie Groups
This section is specifically for CDNs who use a CDN URL (not Cloudflare).
I will be using BunnyCDN in the example which I also use on my site. It’s generally a higher performant CDN than StackPath and highly recommended in Facebook Groups. They have 50 data centers, easy setup instructions, and very affordable pricing. Cloudflare is fine for most sites, but if you’re looking to go the extra mile for faster speeds, you should try out BunnyCDN.
Step 1: In the W3 Total Cache General Settings, enable Genetic Mirror.
Step 2: Sign up for BunnyCDN (highly recommended in Facebook Groups and who I use).
Step 3: Create a pull zone in BunnyCDN.
Step 4: Copy your CDN URL from BunnyCDN.
Step 5: Paste CDN URL in W3 Total Cache → CDN → Configuration Object → Hostname.
Step 6: Configure the other CDN settings in W3 Total Cache.
Step 7: In BunnyCDN, purge pull zone.
Step 8: Run your site in GTmetrix and “content delivery network” should be green in YSlow.
CDN pointers from the plugin developer (found in Install tab) – if you do not use the Media Library, import your images etc into the default locations. Use the Media Library Import Tool on the “CDN” tab to do this. If you do not have a CDN provider, you can still improve your site’s performance using the “Self-hosted” method. On your own server, create a subdomain and matching DNS Zone record; e.g. static.domain.com and configure FTP options on the “Content Delivery Network” tab. Be sure to FTP upload the appropriate files, using the upload buttons.
11. Fragment Cache
Fragment cache is mainly used in dynamic sites. Instead of caching an entire page, individual sections (usually the heavy areas) are cached. You will need to upgrade to W3 Total Cache Pro to use fragment cache. They have recommendations on that page I linked to which makes the plugin aware if you’re grouping transients. However, you may need some coding experience.
12. User Experience
W3 Total Cache comes with basic lazy load settings which fixes the lazy load item in PageSpeed Insights. This delays loading of images until you scroll down and see them. It doesn’t optimize videos, so if you embed YouTube videos on your site, you will need an additional plugin for that.
Active any extensions you’re using. In my case it would be Cloudflare and Yoast.
14. Cloudflare CDN
Cloudflare is free with over 250+ data centers.
If you’re using Cloudflare, there is usually no need to use BunnyCDN. Unlike BunnyCDN, setting up Cloudflare is different and requires changing nameservers. When you’re done, be sure to login to Cloudflare’s dashboard and add Page Rules which can improve speed/security.
Step 1: Sign up for a free Cloudflare account, add your site, and run the scan prompted by Cloudflare. You will eventually come to a page where Cloudflare assigns you 2 nameservers.
Step 2: Login to your domain registrar, find the area to change nameservers, and paste them here. Once this is done, you can go back to Cloudflare and click “Done, check nameservers.”
Step 3: In the W3 Total Cache Extensions tab, activate Cloudeflare and click Settings.
Configure the Cloudflare settings (note: the only thing I changed is enabling hotlink protection).
Step 4: Login to your Cloudflare dashboard and go to Page Rules. Add these 3 page rules:
Page Rule 1: Cache Everything And Force HTTPS – cache your website aggressively.
Page Rule 2: Secure The WordPress Admin And Bypass Cache – sets security level of the admin to high and bypasses Cloudflare’s cache in the admin, since you don’t want CDNs (or apps + performance features like Rocket Loader) running inside the admin.
Page Rule 3: Decrease Bandwidth Of WP Uploads – since the content in your WP Uploads folder does not change frequently, increasing Edge Cache TTL to a month can save on bandwidth, since the WP Uploads folder cache won’t be refreshed as often.
Once you’re done configuring your CDN(s), purge all caches in W3 Total Cache. If you don’t see this, there may be an ’empty all caches’ option in the dashboard tab. It can take up to 24 hours for Cloudflare nameservers to propagate, but you will get a confirmation email once complete.
15. Hosting Recommendation: Cloudways / NameHero
Most hosting recommendations are garbage and I suggest joining the WP Speed Matters Facebook Group which is one of the only groups not controlled by affiliates or SiteGround’s community manager who “moderates” negative posts about their brand like in other groups.
Hosts I Don’t Recommend
- SiteGround has a slow TTFB, CPU limits, declined support, price increases, and other issues. Their TOS (sec. 9) prevents affiliates from using ‘SiteGround’ in bad reviews. I left them in 2019 and stopped endorsing them entirely. As one person said, “SiteGround is no longer any kind of value for the money.” Do your research.
- Hostinger writes fake reviews, votes for themselves in FB polls, also unethical. Employees pose as customers and trick people into buying Hostinger (view poll).
- GoDaddy can actually have a decent TTFB but comes with problems: paying for SSL, malware, slow DNS, and the dashboard gives you little control (see thread).
- WP Engine makes absurd claims like “the unequivocal performance leader in WordPress” when most people migrate away and post much faster load times.
- EIG brands like Bluehost and HostGator have overcrowded servers, slow TTFB, bad support/uptimes, and malware issues (view thread). Mainly promoted by “how to start a blog” affiliates and pay a lot to be “recommended” by WordPress.
Hosts I Do Recommend
Cloudways has excellent feedback in Facebook Groups if you read the threads. I use their Vultr HF plan and have a fast TTFB with nice GTmetrix results (feel free to click through my blog to see how fast it loads). They use Object Cache Pro (Redis), NVMe, and have 39 data centers worldwide. Main cons are no file manager and email hosting is $1/email/month. Cloudways is a little techier because they use a custom dashboard which requires launching a server, but most people find it easy once you get used to it. It’s monthly pricing with no high renewals, 3-day trials, and includes a free migration. If your TTFB is slow, try cloning your site on Vultr HF and test the results (you can also see screenshots of people’s migration results + Facebook polls below). They have high TrustPilot ratings and if for some reason you’re not happy, just cancel your 3-day trial.
NameHero uses LiteSpeed servers which are a newer/faster type of server (it’s cheap and voted highly in Facebook polls). You can find lots of positive feedback in Facebook Groups. I suggest NameHero over similar hosts (like A2) because they’re more reliable with better uptimes and US-based support. They also use cPanel which is beginner-friendly. NameHero has a 30-day refund policy and does free migrations, but I would only use them if your visitors are in the US or Netherlands since that’s where the data centers are. I generally recommend the Turbo Cloud plan which comes with 3GB RAM + NVMe. Large (WooCommerce) sites should use their managed cloud (or Cloudways).
WPX – also uses LiteSpeed (not sure why it’s buried on this page) with excellent support and TrustPilot ratings, but they only have 3 data centers in Chicago, London, and Sydney. Good choice if your visitors are near there, otherwise choose someone else. They also have great feedback in Facebook Groups and include a free migration as well as free site speed optimization where they optimize your site for core web vitals. Main con is price and the dashboard is kind of oversimplified and can be buggy.
Affiliate Disclaimer – I use aff links to the hosts I recommend, but not the ones I don’t.
Each have different setups. On Cloudways, I use FlyingPress + BunnyCDN (or use WP Rocket). On NameHero or WPX, you’ll use the LiteSpeed Cache plugin + QUIC.cloud CDN. They’re both great setups and should give you a fast TTFB – see my WP Rocket or LiteSpeed Cache tutorials.
When in doubt, check Facebook polls and migration results (view more).
Hire My WordPress Speed Optimizer
Still need help with your GTmetrix report? I’ve been working with Pronaya since 2011 (he’s the one who helped me get a such nice scores + load times. You can hire him by creating a profile on freelancer.com and searching for username bdkamol (see his portfolio). He’s $40/hour from Bangladesh (so there is a time change) and his email him is email@example.com. He has a perfect 5 star review on his profile. Serious inquiries only, and please don’t expect 100% scores if you’re using slow hosting, plugins, and theme. Please follow my WordPress speed guide first.
Frequently Asked Questions
Is W3 Total Cache the best cache plugin?
Most people prefer WP Rocket over W3 Total Cache since it comes with features not included with W3 Total Cache, and therefore yields better results in GTmetix. These features include database cleanup, hosting analytics locally, advanced lazy loading of images + videos, heartbeat control, and DNS prefetching. It's also easier to configure.
Which CDN should I use with W3 Total Cache?
Yes, Cloudflare's free CDN is usually fine for most sites, otherwise use BunnyCDN which is highly recommended in Facebook Groups and consistently performant.
What happens if W3 Total Cache breaks my site?
The minification and combination settings in W3 Total Cache are usually the most common culprits of broken elements when using W3 Total Cache. Test each one of these carefully.
How do I clear cache in W3 Total Cache?
Go to the Performance settings and click Purge Everything.
Do I need other speed plugins besides W3 Total Cache?
Yes, you should also install plugins for heartbeat control, database cleanup, image optimization, and either Asset CleanUp or Perfmatters to selectively disable plugins.
See Also: My Full WordPress Speed Optimization Guide (25+ Tips)
That’s it! I know it can get a bit technical so if you have any questions just drop me a line in the comments. And if you enjoyed my tutorial, please give it a share. I would really appreciate that!