How to Setup WordPress Caching with W3 Total Cache (W3TC)
- 1. Beginners Guide to WordPress Internal Functions
- 2. What is WordPress Caching and Why is it Important?
- 3. How does WordPress Caching Work?
- 4. How to Install & Setup WordPress Caching with WP Super Cache
- 5. Currently Reading: How to Setup WordPress Caching with W3 Total Cache (W3TC)
- 6. MaxCDN Review: The Best CDN for WordPress?
The world’s two most popular WordPress caching plugins are WP Super Cache and W3 Total Cache (W3TC). Developed by Mashable’s CTO, W3 Total Cache is by far the most versatile WordPress caching plugin available, used in high traffic sites like Smashing Magazine, Mashable, MakeUseOf and Yoast. This tutorial is a beginner’s guide to configuring W3 Total Cache. Word of advice: W3TC has a plethora of advanced settings some of which I have a hard time comprehending. If you’re unfamiliar with a setting it’s best not to mess with it. Let’s begin!
Install W3 Total Cache
To install the W3 Total Cache plugin, open your WordPress dashboard, followed by Plugins > Add New. Search for “w3 total cache” and install the first result. You can also manually download the plugin and upload it to the wp_content/plugins folder via FTP. If you have previously installed another caching plugin like WP Super Cache, you should disable it before activating W3 Total Cache. This would prevent the two plugins from conflicting. As a rule of thumb, don’t keep more than one WordPress caching plugin activated at any given time.
Configuring W3 Total Cache – General Settings
W3 Total Cache creates a new menu entry called Performance in WordPress dashboard. The options that we’re looking for are under Performance > General. You’ll notice that this page has an overwhelming number of settings for a caching plugin (and a whole lot more if you’re into advanced stuff). Each setting is placed inside a box – called modules. I’ve discussed each of these modules with relevant screenshots. If you get stuck or are uncertain about a particular setting, simply follow the screenshots.
The first module you’ll find is General. I’d recommend not to enable the all the caching options using the toggle checkbox. You might turn on settings that aren’t required (or even supported by) your host – which would inadvertently slow down your website. However, if you want to quickly disable all the modules, this toggle checkbox comes in handy! Before we proceed further, if you’re unfamiliar with the terms ‘page cache’ or ‘database cache’, I would recommend reading How WordPress Caching Works.
Page Cache Module
The second module we’re going to configure is Page Cache. The Page cache method depends on your hosting environment. If you’re using a shared host, Disk: Enhanced is the best option. However, if you’re using a dedicated or virtual server and you have APC (or any other form of Opcode caching installed), you should select the respective option.
Other Caching Modules
The next two modules are Database Cache and Object Cache. Enable each of them and change their caching method to the one best fit to your hosting environment – just like you did under Page Cache and Minify.
The last module that we want to enable is Browser Cache. Once you’ve enabled them, click on Save all Settings. That should do it! W3 Total Cache is now enabled in your server. We will now take an in-depth look into two specific modules – Page Cache and Browser Cache. The rest of the modules’ default values are just fine.
Page Cache Settings
The Page Cache settings can be found under Performance > Page Cache. The settings here are fairly self explanatory. I’ve enabled a couple of them – specially Don’t cache pages for the following user roles. This ensures that when an author is editing a post, he/she will able to view the latest version and not the one from the cache.
Preloading the Cache
By default, W3 Total Cache caches a page when it is first requested. You also have the option to pre-generate copies of all the posts/pages. This way, regardless of when a visitor requests a page, the cache is ready and the page is served in the lowest possible time.
You should configure the cache preload settings based on your hosting environment and the amount of traffic your website receives.
- The cache Update interval directly affects server resources – lower the time interval (i.e. higher the frequency), greater the server resource consumed. People on shared hosting servers should be very careful with this setting. Set a high enough frequency and you might just get your account suspended for abuse of server resources. A safe cache preload interval is one hour – i.e. 3600 seconds.
- If you’re unfamiliar with the Sitemap URL, install Google XML Sitemaps. It’s super easy to use and is in fact, a must-have plugin.
- Finally, you want to enable the last option which will trigger a cache preload operation when a post/page is published.
Browser Cache Settings
How do you know that W3 Total Cache is actually working? Well, the plugin page says so. You can also view the source code of your site find something like this:
W3 Total Cache Performance Benchmark
I waited around 1 hour after I enabled caching and benchmarked the website’s performance using GTmetrix. This is without any caching plugin:
This is one hour after W3 Total Cache was configured:
Notice the difference? A 3% and 5% increase in Page Speed and YSlow Grade. Neat, right? Now imagine a thousand people visiting your site daily – imagine the amount of CPU cycles (fancy term for resource usage) you’ll save. Caching not only reduces you page size, but it also improves the overall site’s performance which paves the way to a great user experience.
Troubleshooting W3 Total Cache
You might notice that your site’s load time has increased after installing W3 Total Cache. Is that even possible? Of course it is! In fact, this is a very common beginner’s mistake. There can be a lot of reasons behind this:
- The most probable reason is that you’ve conducted the website benchmark while preloading the cache. Building the cache consumes considerable server resources. Imagine your request on top of that – of course your site would become slow! Solution: wait for an hour and try again – this time it should be different.
- Another common reason is selecting the wrong caching methods. Let me tell you that anything other than Disk caching involves certain amount of A/B testing. You need to play with some of these settings in order to squeeze the best possible result.
- Sometimes on a shared server you might find APC or some other Opcode caching option available – and it’s likely that you’ve selected it. Don’t! Revert to ‘Disk’ or ’Disk Enhanced’. The reason being that those settings have been fine-tuned for the overall performance of the shared server – remember you’re not the only person using it. These settings might not work with W3 Total Cache.
If you’re still facing problems and you’ve tried the default/recommended values, I recommend switching to WP Super Cache.
.htaccess File Permission Error
Depending on your hosting environment, you might see an error message stating that your .htaccess file isn’t writable. This means that the webserver and/or PHP handler does not have the permission required to modify the .htaccess file. There are two solutions:
- You change the permission of the .htaccess file to 775 via FTP or cPanel, etc.
- You manually add the data to the .htaccess file
I must point out that the second method is safer and is considered a good security practice.
Conclusion – Which Plugin Should I Use?
You might be wondering which WordPress caching plugin to use. After all, I did write two separate tutorials to achieve the same goal. Should you go for WP Super Cache or W3 Total Cache? Well, to make a long story short – if you’re on a shared server and don’t want the hassle of A/B testing and/or troubleshooting, WP Super Cache is much easier to implement. However, if you’re using a virtual or dedicated server with Opcode caching (like APC or XCache) installed – and wouldn’t mind some extra work, then W3 Total Cache is for you. When configured properly with advanced methods, W3TC’s results are far superior.
This concludes setting up our caching plugins. I’ll also discuss how to setup a CDN with each of these plugins. In the meantime, you could check out some of the best free CDNs for WordPress and stay tuned.
Parting question: What’s your favourite caching plugin? How much difference did it make in your site’s performance? We’d love to hear from you!
Useful tutorial. Thanks dude for sharing it!
I just installed this plugin on my site a few days ago. Wish I had found this post earlier, it would have saved me a bunch of tine looking for tutorials…lol Oh well, its a great article. Just wish i had found it sooner.
Hi there nice explanation how ever i disagree with the settings it will slow down most people websites and make it worse trust me, these are not the right settings at all. Due to shared hosting environment for 90% of users out there using page cache or database caching makes your shared hosting even slower due to disk load time because we are not using memcache or other memory caching or ssd drivers either. So for shared hosting i would leave everything off in w3tc cache settings except but most important is Browser cache so it spits out static HTML pages instead requiring to query php and mysql each visit…that is all you need to make your site go 70-85% faster, and add CDN (content Delivery Network) from max cdn or amazon cloudfront, add 4 subdomain cdn channels like this cdn1,cdn2,cdn3,cdn4 so css and java files are server from the Cloud including your images and theme files, i wrote up my guide here. Please take a look and you see what iam talking about, i did many websites like that powered by WordPress and the speed of the sites are amazing including Spazlport website loads under 1 second with this configuration with Arvixe hosting which is comparable like Hostgator and other major companys out there, however the speed really improves when you use CDN in my case Amazon Cloudfront and oh boy its fast!
Thanks Spazlport, I do agree to a certain extent, in most cases you are 100% right about the shared hosting and the settings that should be used, but on some shared hosting its fine, such as the Media Temple Grid. I did a lot of experimenting there and I found enabling the extra settings does help out, although this was about a year or more ago, so I may be wrong now.
CDN is a MUST for shared hosting, I agree! I think CloudFlare is good although I don’t use it anymore and some users have reported that it goes down often these days, so who knows 😉 We posted a nice write up of some of the best free CDNs outs there.
Thanks so much for stopping by and leaving a really useful comment and linking to your guide which is very helpful for our readers. If you’d ever like to contribute to WPExplorer we would like to have ya!
I agree with you Clarke, iy seems Godaddy shared hosting now uses apc cashing which with database and object cache turned on with apc and not disk is actually pretty fast. As for CDN to be honest i like Amazon’s the free cloudflare goes down a lot and they say if their service is down your normal server resolves….well that’s not the case its a big 502 error and emails from google webmastertools that site is not reachable.. Bad for seo for sursky.
Yes, I used to use Cloudflare but never really liked it. I use WPEngine now and they have a built-in CDN 😉 However, WPEngine is so fast you don’t even need it.
Will this work with WP Multisite?
Ya W3 Total Cache works with multisite, but you’ll have to set it up for each individual site. I personally don’t use it though because I prefer to host with WPEngine where they do all the caching automatically for me 😉 I’m spoiled like that!
i am planning on using the plugin really just for the amazon s3 features since none of the stand alone s3 plugins allow individual site settings in multisite for cloud uploads of media… so ill either be using total cache or super cache… so i think this will be perfect
Indeed i switched to Digital Ocean VPS 1 Gig Ram VPS hosting and using W3 Total cache with Memcached and disk to cache page cache oh man what a difference in speed the most i love is that when you click on a option in the Admin are its there you don’t have to wait 2 minutes to go to setting pages it is so fast now, and love memcache and all the goodies i couldn’t use before on shared hosting.
I followed this one, but would need more details about which CDN should I use? Should I go with Cloudflare free or should I opt for Max CDN?
It depends on your own personal needs more then anything, so you’ll have to investigate to see which fits in your budget, technical skill-level and overall site needs.
My site scored worse after an hour, not better?
The settings depend 100% on the server, you’ll need to research your server a bit to see what best works for you. Also in some cases it could potentially make it worse, again depending on your server.
hello admin i have done all these settings but my site still shows speed 63 why?
Your site is loading in under 3 seconds which is fast, I wouldn’t worry about it too much. If you are concerned about the scores you’ll have to Optimize your images and possibly switch to a better WordPress host.
I do not know what are you attempting to do with your confusing tutorial. You jump over the fields…you have done 20% job.
Rather then leaving a negative comment, why not provide some insight as to how we can make our tutorial better.
Newbies always find the way to increase their site speed at any cost. But what? they survive to get it, but why? due to the lack of research and having very few knowledge about what are the best ways to increase site speed.
I’m sure those newbie bloggers will take maximum advantage of this post where you’ve mentioned all steps in a simple way.
Thank you for sharing!
Yes i have used this plugin. As a newbie in blogging, wish to see more articles on how to improve performance of a website
I have installed this w3 total cache now my speed well in in mobile and destop but i dont like w3 total cache create many files whenever i take back up my back up is round 250 MB or more
Depending what you are using for your backups, you should be able to exclude the cached files from it.
Thanks for a great article.
I have noticed that the option “set expires header” has been disabled by W3 if using cloud front. As a result browser caching is not working 🙁 Any idea if there is a work around for this? I have searched the webb four hours but have been unable to find any solution besides turning cloud front of which i don’t won’t https://wordpress.org/support/topic/set-expires-header-option-in-browser-settings-is-disabled?replies=16. Any suggestion on how this could be solved would be extremely valuable.
Thanks in advance,
Hope its ok to ask a question on this tread? I’ve activated the W3 plugin and It was conflicting with the mobile site, I’ve turned Minify off and it seems to do the trick. I’ve tested the site in an incognito browser and on mobile, and both seem to display ok, but when I run a speed test, the image it displays is corrupt, am I missing something?
Thanks in advance
You’ll want to ask on the W3 Total Cache support forum. You may want to share additional info (theme you are using, URL..etc) because it’s impossible to know whats going on without at least being able to see the site in question.
Have you had any experience with any of the caching methods listed on NGINX servers? Any tips or advice ?
Great article – I’ve linked to it from my new guide for setting up super fast Mercury installations. The only difference is instead of using Disk:Enhanced you get to use Opcode: APC which is FAR faster.
thanks .. really nice tutorial helped me to configure that aliantic plugin 😀
I use W3TC Pro with Web Synthesis, FireHost and sometimes Pagely ( no longer on the VPS just shared) well my point is there is a resource you can use to set up your W3TC plug-in and though it does not do everything I strongly recommend utilizing it especially if you have not used it before.
This URL will take you to where you can download the configurations for shared and VPS Web Synthesis up load it to your system and you will see an improvement. Fragment caching is locked in less you purchase the pro version.
Even though synthesis comes with it because you’re not on their you have to purchase pro-to get fragment caching.
PS do not forget to activate Yoast, feedburner if you are using CloudFlare activate it. If you are using Genesis and are not using HHVM Pro is not expensive when you think about it.
PS anybody thinking of adding a CDN MaxCDN is better than CloudFlare Pro but EdgeCast, Fastly & CacheFly are faster.
Thanks for the link! That’s awesome that websynthesis makes it so easy for their customers 🙂
USe w3 total cache.
.htaccess File Permission Error
Due to the security plugins, other plugins lost their writing permission to .htaccess and other files. Even you could not see the image which was recently updated. The solution is simple.
1. Check the directory permission level is 755 (in case WordPress installed in the directory).
2. Now check the file permission for .htaccess which is necessary to be 644. Otherwise, you will encounter the error.
Initially I was using Super cache but after that I landed on your blog and implemented W3 total cache According to your given settings.I must say now my blog is loading much faster Than before..Thanks a lot 🙂 This plugin is simply awesome.
Have given up on the minify settings for W3tc and will just leave it as it seems to increase my site’s pageload times.
Am curious about how fast your site is though. Your page size is over 1mb with a page load of under 2 secs. Mine is Page load time: 2.72s
Total page size: 453KB
Total number of requests: 73 (minify settings turned off) on GT metrix
Am using cloudflare and shared hosting. Is WP engine still working well for you? Am happy with my current hosts but have been googling more recent reviews of WP engine.
I keep my fast first of all by using WPEngine and second I use a combination of two plugins “CleanerPress and AutoOptimize” with specific settings enabled/disabled to my specific needs. It seems to work well for me. I can also enable a CDN via WPEngine but that costs me several hundred dollars a month and I don’t really think it makes much a difference.
In the Minify section of the General Settings, the Enable check box will not remain checked after the Save All Settings. Apparently, Minify depends on some resource that is not available. Any suggestions on to resolve this?
Strange. Have you contacted the plugin developer via the WordPress.org plugin repository forum for some help with that? I think they also have a Pro version with included support.
Yes, not only did I purchase W3 Pro, I also purchased their plugin configuration support. It’s been more than a week and they have not contacted me, or responded to phone messages, email messages, or support tickets. Apparently, they don’t provide paid support any more, but they still have the option to pay for it. I’ll have to contact PayPal to get my $100 back. The fact that they will not respond after paying them $100 for support makes me quite nervous that this plugin is no longer supported or maintained. I contacted a consultant with W3 experience to help, but we still can’t get page caching to work.
Ugh..I wasn’t aware of this. That sucks! Thank you for letting me know and sharing your experience with others. Personally I just use WPEngine for my hosting which has all caching built-in so I never have to deal with caching plugins and I love it.
Hopefully you can resolve your issues soon, finders crossed for you!
Nice article . But I have one query regarding browser cache. I used w3 total cache on my blog Technosnoop.Google page insight showing Leverage browser caching to 2hrs so what expiry time should I set for my blog.(HTML,Media, Css and JS).
I always have a problem with minify with CSS, it generally removes everything and reduces my site into just text. May be the theme I’m using that is causing this though….
Yes I would first try contacting the theme developer if you are using a premium theme, it’s possible the CSS isn’t being loaded correctly.
Nice post. I thought that W3 total cache would be the best solutions to decrease my website’s load time. But everything went opposite.
Before installing it my website’s load time was 7.59s which has now reached to 8.31s. Any idea what happened wrong?
Alex, Cloudways is also recommended this caching plugin.
Hello I have the plugin W3 Total Cache, but I want to put another plug translator of my blog called Transposh, and turn it tells me to put apc, I have a shared server, now I am very comfortable with Total cache, but I want to know and install what is called APC. thanks
Someone else please correct me if I’m wrong – but I believe APC is just another caching plugin. Since you’re already using W3 Total Cache I think you can safely ignore the APC notice 🙂
Hey, I have a problem whenever I use W3 total cache. I use zonker theme on website & W3 total cache crashes the site’s icons. They later appear to be a square & it ruins the look of the site. you can check the site on thebrandkart.net
This is something to best contact the theme developer about for the theme you are using.
I just try W3 Total Cache with this setting. My load was 4.6 seconds .. I hope I’ll see an improvement
FWIW, I could never get W3TC to work well, and technical support never responded to my requests for assistance after having paid them. I dumped W3TC and switched to hosting on WPEngine. It was the best decision I have made since implementing WordPress sites. Now, all my sites are hosted on WPEngine and I couldn’t be happier.
It’s great article. I have faced some problem like posts not updated regularly. But after modification I have solved my problem..! It’s really simple & great.
Hi, I set up this some time ago to be more precisely option CALLED
Preloading the Cache
But now after login to wordpress I can’ see this option. Do you know why ?
Please Inform That if Enable Object Cache is checked may cause very slow or accessible admin panel after some times as happened to me and i have to disable object cache and after that i have no problem with this Great plugin
TnX for your tutorial too
W3TC is no longer supported. I recommend using some other solution.
Oh no 🙁 Thanks for letting us know!
Super! Thanks for this post. Followed all suggestions here and it sped up my site :).
Its so strange, after i switch to memcached than my site get slower, to open an static page like contact has take about 1minute .. after switched to disk, then every go smooth again ..
does anyone know how to optimize memcached?
for note, i’ve try click “Test” button and passed for memcached ..
Update: strange, using Database Cache : memcached and Object Cache : Disk, and my site now got very fast response …
But when i change Object Cache to memcached, then everything goes slower..
I hope someone can explain to me..
its work when i dont add this plugin then my speed is 67% but now it is 84% wooo
Wow – that’s a huge improvement! Wooohoo indeed!
I receive a 403 error code when analyze my site speed at GTMetrix and Google Page Speed tools. Can u tell me what is the reason for this. I really love the W3 Total cache because it is the cache plugin for WordPress
That is a bit strange…I am not sure why it would do that. Can you check your robots.txt and make sure you aren’t blocking access to the site?
Minify via disk is currently disabled
I tried to check the box and when I save after the refresh, it’s disable. enabling it 100 times over still results in an unchecked box, and the message “Minify via disk is currently disabled. Anyone know how to fix that ?
Hello. Your post is just like a Guide. My site became faster.
from 87% to 94%
adn Yslow from 70% to 82% Thank you
That’s awesome! Nice work 😉
Very good tutorial and will work for most WordPress setups. As for VPS we just use page caching and Browser caching advanced so W3TC generates HTML documents and Nginx serves plain HTML pages very fast.
I just discovered w3total cache through your website.
I installed it and made settings as mentioned here and guess what
My website speed increased by 80%
Thank You very much
That’s awesome! 🙂
I followed your tutorial. But still, I am not able to achieve this score?
A good score depends mostly on your server and how you built your website. Even with proper caching setup you can still get a low speed score. If you want a fast website my advise is to first look for a good hosting company. Also most of the good WordPress hosts already have built-in cache so you don’t ave to install or setup a plugin such as W3TC to your site.
W3TC is comparable (or even better) than the overhyped WP-Rocket when configurations are set properly. Bought WP-Rocket today to do a comparison with W3TC and the paid plugin didn’t match up to W3TC properly configured settings.
Thanks for stopping by and leaving such valuable feedback. I agree that a properly configured W3TC plugin will stand up to ANY caching plugin out there, it really is that good. The problem is when the plugin isn’t properly configured then other plugins that are “easier” to setup like WP-Rocket may outperform. That said, WP-Rocket does have a few things (not cache related) that can help overall site speed such as image lazy loading. Personally though, I am a big believer in using managed WordPress hosting and all managed WP hosts have built-in cache that is setup exactly to your server specs, so you never need to use a 3rd party plugin or worry if your cache is setup properly.
Great tutorial. W3 Total Cache is my favorite plugin for optimization. Recently, I am facing slow speed issue on one of my blogs. I will follow your guidance to optimize and improve the page speed.
I love w3 total cache when it works. But I have had problems with it recently. Do you know if it’s abandoned or if there is still active support for it?
It’s definitely not abandoned – it was just updated 4 days ago 🙂 As for support, visit the W3TC support tab for the plugin to ask questions. It looks like a moderator was active just a day ago, but if you want immediate assistance you can always purchase premium support from the W3TC developers.
Good to read the article.I just want to know that is there any special settings of w3t for shared hosting sites.
Hi, there is no special settings specifically for shared hosting as opposed to dedicated. However, there are certain settings that are better for different hosting companies so it’s good to ask your hosting company if they have a guide for setting up proper WordPress caching. Some shared hosting companies actually offer “managed” WordPress hosting with built-in caching, that’s what we always recommend. Such as Flywheel, Kinsta, WPEngine, Siteground..etc.
after disturbing NameCheap about my error 500, this is the only good thing I got from them so far. Well, i can see that it is well explained and clears steps. thanks
w3 total cache is really beneficial for sites having more traffic. You have discussed very well along with the images and content for installation of w3 total cache on wordpress.