Beginner’s Guide: How to Set Up W3 Total Cache for WordPress
If you’ve ever searched for a WordPress caching plugin at wordpress.org, you know that W3 Total Cache is one of the most popular caching plugins out there. It has some pretty impressive download numbers. Some people love it. Others hate it. But no one can deny that it’s popular.
But here’s the thing about it:
Most people have no idea how to set up W3 Total Cache. Because W3 Total Cache is incredibly confusing.
I mean, the actual install process is simple enough. But then the plugin bombards you with a huge number of configuration options. There’s browser caching (simple), object caching (a little less simple) and even things like fragment disk caching (not at all simple!). Unless you’re a developer, it’s definitely enough to make your head spin.
And here’s the really annoying thing:
You can’t just enable all of the options. If you’re on shared hosting (like most people), that might actually slow your site down. So you need to pick and choose which caching types to enable and how to configure Them. Confusing!
To remove that confusion, I decided to create this mega-guide for how to configure W3 Total Cache. I’ll take you through every option so that you know what you need to turn on, and what you should turn off.
The guide will be primarily focused on the needs of a regular WordPress user on shared WordPress hosting. If you have a dedicated server, you might need to do things a little bit differently.
It’ll be a long one – so make sure you’re comfortable! Let’s dive in…
1. Configuring the General Settings
There are basically two layers to W3 Total Cache’s configuration options. First, you have the General Settings where you enable or disable W3 Total Cache’s 10+ different modules. Then, you have a separate settings page for each individual module.
When you first install W3 Total Cache, your first step is to configure the General Settings:
So, start by clicking on the General Settings tab. Here’s how to handle each option you’ll see on the General Settings page…
The first box lets you quickly toggle on or off all of W3 Total Cache’s options. It would be great to just click this button and call it a day…but you really shouldn’t.
The other thing you can do here is enable Preview mode. In preview mode, the changes you make won’t actually be pushed live until you deploy them. If you’re working on a busy live site, you should consider using it.
But if you’re configuring W3 Total Cache on a fresh WordPress install or a website that doesn’t get much traffic, you can ignore preview mode.
1.2 Page Cache
The next box you’ll see is Page Cache. You absolutely want page cache. Just page caching by itself should give your site a noticeable performance boost.
After enabling it, you’ll next need to choose your Page cache method. The method you choose depends on your hosting.
- For shared hosts: Choose Disk: Enhanced.
- For dedicated or VPS: You can opt to use one of the Opcode cache methods.
If you’re not sure what type of hosting you have, that probably means you’re on shared hosting :) So when in doubt, choose the default Disk: Enhanced method.
Minification is something that Google PageSpeed Insights always recommends, so you’ll definitely want to enable some form of minification.
When you click the enable button, W3 Total Cache will give you a warning message about possibly breaking your site. And they’re absolutely right – you may need to play around with minification to find what works for your specific situation:
Start by leaving Minify mode as Auto. But I can’t promise that this won’t break parts of your site. If it does break your site, you’ll need to play around with the options. Or, at that point, I usually just switch to a plugin like Autoptimize for minification and leave minification disabled in W3 Total Cache. Another good option is to use CloudFlare and its built-in minification.
Definitely try W3 Total Cache’s minification first, though. It’s by no means guaranteed to break your site.
1.4 Opcode Cache
Newer versions of W3 Total Cache include Opcode caching. But if you’re on shared hosting, you probably can’t even enable it. For most users, you’ll likely see Not Available. So feel free to ignore this box. That’s what I do!
1.5 Database Cache
To quote the creator of W3 Total Cache, “W3TC is a swiss army knife and you should try. In general caching object cache and database cache to disk is not recommended.”
Database caching can potentially speed up your site by pushing work from the database to the processor/memory. But here’s the problem – for most shared hosts, the database can actually better handle that stress than giving your processor and memory yet another task (over simplified, but that’s the basic point). So in order to save time on database queries, database caching can actually slow down your site by overloading the other aspects of your server.
All that to say, if you’re on shared hosting, you should leave database caching disabled.
If you want, you can test it for yourself. But for most situations, you should leave database caching disabled unless you’re on a dedicated server.
1.6 Object Cache
Object caching might speed up your WordPress site…or it might also slow your WordPress dashboard to a crawl.
See, if you’ve ever tried to diagnose why your WordPress dashboard is slow, one of the most common suggestions is to disable object caching.
For that reason, I recommend leaving object caching disabled. You can feel free to test it, but if you’re on shared hosting, it won’t give you much benefit and might just slow down your dashboard.
The one exception, as noted by W3 Total Cache, is if you’re running a site that’s “highly dynamic” (e.g. BuddyPress, bbPress, etc). Then, you might want to consider enabling object caching.
1.7 Browser Cache
If you’ve ever run your site through Google PageSpeed Insights, you know that “leverage browser caching” is one of the tool’s favorite messages. Well, this is where you apply that leverage.
Browser caching is a simple method to improve performance by caching some data in your visitors’ browsers. Because it’s all about storing data locally on your visitors’ computers, there’s no danger it slows down your site.
So no matter what type of hosting you’re on, you should absolutely Enable browser caching.
If you’re using a CDN, you can connect it to W3 Total Cache in this option. You can either try to find your CDN service from the dropdown or choose Generic Mirror if it’s not listed.
If you’re using CloudFlare, you don’t integrate it here. Instead, you’ll need to add the CloudFlare extension. You can do that by going to W3 Total Cache’s Extensions tab.
If you’re not using a CDN, you should leave this box disabled. Enabling it only works if you already have a CDN provider.
1.9 Reverse Proxy
The vast majority of WordPress sites should ignore the reverse proxy option. Reverse proxy is one of those things where if you’re advanced enough to use reverse proxies, you probably wouldn’t be reading this guide :)
1.10 Monitoring, Fragment Cache, Misc, and Licensing
Similarly, you can ignore all of these options. Just skip past them to the Debug section at the bottom of the page.
If you’re having issues with W3 Total Cache, you can enable the debug options. But only do so temporarily. For normal use, you should uncheck all of these boxes. When not actively being used for debugging, all they do is add unnecessary code to your site.
And that’s it as far as the General Settings page goes. Make sure to click Save all settings and then you’re done!
Configuring Individual Caching Methods
Now that you’ve chosen which methods to actually enable, you need to actually go through and configure each method in a little more detail. Those are all of the other options in your sidebar that I marked at the beginning of this article.
I’ll go through them in order below. You don’t need to configure options that are disabled, so you won’t need to go through every single item.
For all of these, if I don’t specifically mention a setting, you can leave it as the default. There are far too many options to address each one individually.
How to Configure Page Caching
Page caching is up first. Most of the settings can be left as the default, but there are a few key tweaks which need to be made.
First off, if you’re using SSL, you should check the box to Cache SSL (https) requests. And you should also Cache feeds whether or not you’re using SSL:
A bit further down the page, you should turn on the option to Automatically prime the page cache. And you should also choose to Preload the post cache upon publish events. You can leave the numbers as the default. Make sure you add your sitemap URL, as well:
Unless you specifically know what you’re doing, you should leave everything else alone. Just make sure to save your changes.
How to Configure Minify
The minify section can be tricky to configure. Because you can’t know for certain if something will break your site until you try. So you should try starting with the defaults at first. But if something goes wrong on your site, you may need to tweak things a bit.
Honestly, you can try to play around with W3 Total Cache’s minification settings to fix it. But that requires you to go in-depth with lots of issues that even I don’t understand. Basically, it requires an ability to actually diagnose what’s going wrong, which can be tricky for non-developers to handle.
Therefore, I think it’s much easier to just switch to Autoptimize if W3 Total Cache’s default minification settings are causing problems. If you’re using CloudFlare, you can also take advantage of CloudFlare’s built-in minification.
If you do switch to Autoptimize or CloudFlare, just make sure to disable minification in the General Settings tab.
How to Configure Browser Cache
Next up, you need to configure browser caching. Remember, I skipped database caching and object caching because those should be disabled for most of you.
For browser caching, you should enable all six of the first options. That means enable:
- Set Last-Modified header
- Set expires header
- Set cache control header
- Set entity tag (eTag)
- Set W3 Total Cache header
- Enable HTTP (gzip) compression
A little bit further down the page, you should also check the box for Do not process 404 errors for static objects with WordPress:
You should be able to leave everything else as the defaults.
How to Configure CDN
Unfortunately, I can’t give you specific instructions here because the exact configuration depends on which CDN you’re using.
Thankfully, because of how popular W3 Total Cache is, most CDN providers offer instructions detailing the setup process. I’ve collected a couple sets of instructions for popular CDNs below:
- MaxCDN instructions: Setup WordPress with W3 Total Cache
- KeyCDN instructions: WordPress CDN Integration with W3 Total Cache
Remember, if you’re using CloudFlare as a WordPress CDN, you need to add the CloudFlare extension in W3 Total Cache’s Extensions tab.
W3 Total Cache Extensions
I’ve already mentioned the CloudFlare extension, but W3 Total Cache also includes extensions for a number of other tools.
For example, you can get extensions for:
- Google AMP pages
- Genesis Framework (definitely get this if you’re using Genesis)
- Yoast SEO
- WPML (get this if you’re using WPML for translation).
Each extension may require further configuration. For example, if you enable the CloudFlare extension, you’ll need to enter your API key to activate it. Then, you can manage how CloudFlare functions from inside W3 Total Cache:
Too Complicated? Pick Another Caching Plugin
Honestly, I’m one of those people who doesn’t recommend W3 Total Cache. I wanted to write this guide because W3 Total Cache is undeniably popular and I think beginners need help with it. But I no longer use W3 Total Cache for my newer personal sites.
My recommendation is to simply use a more beginner friendly caching plugin. I’ve been using KeyCDN’s Cache Enabler for my sites and love it. Whereas W3 Total Cache takes an hour to set up, Cache Enabler takes a minute. And for most sites, the performance enhancements are no different.
Sure, Cache Enabler doesn’t have options for methods like database caching, object caching, opcode caching, etc. But regular WordPress users don’t need that functionality. It’s just unnecessarily confusing.
So, unless you’re set on W3 Total Cache, consider using Cache Enabler instead.
Wrapping Things Up
I tried to cover everything about setting up W3 Total Cache from the perspective of a regular WordPress user on (probably) shared hosting. But seriously, this thing is a mammoth, so I couldn’t hit every single setting item and situation.
If you’re still left with any questions about how to set up W3 Total Cache, leave a comment and I’ll do my best to help you out. I can’t promise to know everything, but I still use W3 Total Cache on one of my older sites, so I know my way around pretty well.