How to Setup WordPress Caching with W3 Total Cache (W3TC)

Post Series: Guide to WordPress Caching
  1. 1.A Beginners Guide: Understanding WordPress’ Internal Functioning
  2. 2.What is WordPress Caching and Why is it Important?
  3. 3.How does WordPress Caching Work?
  4. 4.How to Install & Setup WordPress Caching with WP Super Cache
  5. 5.How to Setup WordPress Caching with W3 Total Cache (W3TC)
  6. 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

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.

W3 total cache general settings module

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

W3 total cache page cache

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.

Minify Module

W3 total cache minify module

The Minify module compresses the CSS and JavaScript files your theme uses, by removing unnecessary lines of code like comments and whitespaces. This reduces the filesize by ~10% which results in a faster site. Under Minify cache method you should select the appropriate option based on your server.

Other Caching Modules

W3 total cache object cache

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.

W3 total cache browser cache

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

w3 total cache advanced settings - page cache

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

w3 total cache advanced settings - cache preload

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

w3 total cache advanced settings - browser cache

This is found under Performance > Browser. The idea is to leverage your visitor’s device. Enabling Browser cache would make the static files (such as CSS, JavaScript and images) to be served from your visitor’s browser cache. Of course, there’s an expiry time which would prevent the use of obsolete data. This removes a huge load from the server, saves bandwidth and greatly improves your site’s overall performance.

It’s Alive!

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:

caching works

W3 Total Cache Performance Benchmark

speedometer

I waited around 1 hour after I enabled caching and benchmarked the website’s performance using GTmetrix. This is without any caching plugin:

before caching

This is one hour after W3 Total Cache was configured:

w3 total cache benchmark results

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

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?

WordPress Caching plugins

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!

  • Published on:
  • Last Updated on:
  • Posted Under: WordPress Plugins
Sourav
Post Author: Sourav

Sourav is a WordPress enthusiast, an avid gamer and a sitcom collector. His playlists include heavy metal, electronic, and new-age tracks. When he's not online, he's spending quality time with his friends and family. You can follow him on Twitter.

Disclosure: This page contains external affiliate links that may result in us receiving a comission if you choose to purchase said product. The opinions on this page are our own. We do not receive payment for positive reviews.
Got something to say? Join the discussion.
  1. Thomas says:
    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.
  2. Spazlport says:
    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!
    • AJ Clarke says:
      AJ Clarke
      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!
      Admin
      • Spazlport says:
        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.
        • AJ Clarke says:
          AJ Clarke
          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.
          Admin
    • AJ Clarke says:
      AJ Clarke
      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!
      Admin
      • Jason Lee Neri says:
        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
    • Lazlo SpazlPort says:
      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.
  3. Aditya Nath Jha says:
    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?
    • AJ Clarke says:
      AJ Clarke
      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.
      Admin
    • AJ Clarke says:
      AJ Clarke
      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.
      Admin
  4. devinder says:
    hello admin i have done all these settings but my site still shows speed 63 why?
  5. Villas Diani (@villasdiani) says:
    I do not know what are you attempting to do with your confusing tutorial. You jump over the fields...you have done 20% job.
    • AJ Clarke says:
      AJ Clarke
      Rather then leaving a negative comment, why not provide some insight as to how we can make our tutorial better.
      Admin
  6. adeemj says:
    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!
  7. Lohith says:
    Good article. Yes i have used this plugin. As a newbie in blogging, wish to see more articles on how to improve performance of a website Cheers
  8. davinder says:
    hi 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
    • AJ Clarke says:
      AJ Clarke
      Depending what you are using for your backups, you should be able to exclude the cached files from it.
      Admin
  9. Jakob says:
    Hi, 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, Jakob
  10. Matt Selby says:
    Hi all, 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
    • AJ Clarke says:
      AJ Clarke
      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.
      Admin
  11. Jesse Kanner (@jessekanner) says:
    Have you had any experience with any of the caching methods listed on NGINX servers? Any tips or advice ?
  12. Dave Hilditch says:
    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.
  13. Mohamed Oka says:
    thanks .. really nice tutorial helped me to configure that aliantic plugin :D
  14. Blueprint Marketing (@blueprintmarket) says:
    Hi Guys, 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. http://websynthesis.com/importing-w3-total-cache-settings/ PS anybody thinking of adding a CDN MaxCDN is better than CloudFlare Pro but EdgeCast, Fastly & CacheFly are faster.
    • Kyla says:
      Kyla
      Thanks for the link! That's awesome that websynthesis makes it so easy for their customers :-)
      Admin
  15. Lucky Bhumkar says:
    .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.
  16. Sumit khantwal says:
    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.
  17. Urbanite says:
    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.
    • AJ Clarke says:
      AJ Clarke
      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.
      Admin
  18. christopherglaeser says:
    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?
    • AJ Clarke says:
      AJ Clarke
      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.
      Admin
      • christopherglaeser says:
        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.
        • AJ Clarke says:
          AJ Clarke
          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!
          Admin
  19. surajuraj says:
    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). Thanks
  20. Ryan says:
    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....
    • AJ Clarke says:
      AJ Clarke
      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.
      Admin
  21. Daniel Keith says:
    Hi there, 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?
  22. fertabasco says:
    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
    • Kyla says:
      Kyla
      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 :-)
      Admin
  23. Chinmay says:
    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 Please help.
    • AJ Clarke says:
      AJ Clarke
      This is something to best contact the theme developer about for the theme you are using.
      Admin
  24. Princess Kaurvaki says:
    I just try W3 Total Cache with this setting. My load was 4.6 seconds .. I hope I'll see an improvement
  25. christopherglaeser says:
    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.
  26. Ganesamoorthi M says:
    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.
  27. Pracaonlinedziennik says:
    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 ?
  28. reza10 says:
    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
  29. christopherglaeser says:
    W3TC is no longer supported. I recommend using some other solution.
  30. Candy Ayala says:
    Super! Thanks for this post. Followed all suggestions here and it sped up my site :).
  31. ghprod says:
    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 .. Thanks
    • ghprod says:
      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.. Thanks
  32. sailesh says:
    its work when i dont add this plugin then my speed is 67% but now it is 84% wooo
  33. Gaurav Verma says:
    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
    • AJ Clarke says:
      AJ Clarke
      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?
      Admin
  34. Dope Shop says:
    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 ? Thank you
  35. Cabra says:
    Hello. Your post is just like a Guide. My site became faster. from 87% to 94% adn Yslow from 70% to 82% Thank you
  36. beachpcrepairs says:
    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.

Leave a Reply