W3 Total Cache Best Settings: WordPress Speed Plugin

Improving a site's efficiency is often an overlooked practice. A good example of software ripe for some optimization work is WordPress. Out of the box, WordPress is an excellent tool for building a blog or business website but it's rather inefficient unless tweaked a little. Caching for WordPress is a great way of squeezing a few more percentage points of speed from your site. A faster website is a more profitable website. In this article, I'll show you how to set up w3 Total Cache and optimize it using the best settings to speed up your WordPress website.

What is a Cache and How does it work?

In simple terms, a cache is a time-saving device. As business owners, web administrators, and bloggers we are well aware of the speed limitations of our websites. Reducing file load times is a high priority for most of us but many people are not familiar with web cache software, which can significantly improve download speed on your site. Caching is an important part of WordPress SEO. We'll examine the benefits of using one of the most popular cache tools for WordPress, W3 Total Cache.

A Web cache uses temporary storage (or caching) of HTML pages, images, style sheets, JavaScript, and many others to reduce the load on the server. A web cache serves static files instead of slower dynamic files to users and this speeds up the delivery of data considerably. Using caching properly can have the biggest positive effect on the response time of your site. With the increased use of large images and video in websites, it’s becoming more important to conserve bandwidth to deliver faster pages to the ever distracted and impatient consumer.

Using caching properly can have the biggest positive effect on the response time of your site

Caching is used by computers, your ISP, your web server and your browser. It’s a very important technique used for two main purposes:

  1. To conserve bandwidth by reducing traffic.
  2. To reduce latency (delay in transferring data).

One question I hear is if caching is bad for sites that continually update data. The answer is it depends on what kind of web pages the site is delivering. Let’s look at an example. Reuters, the news site, no doubt uses caching for their homepage and you might wonder if the content you’re reading is out of date, because it's somehow cached. What happens is that when you look at the Reuters front page for the first time the site's server will deliver all the content including images, video, and text. If you request the page an hour later the caching software checks to see what has changed. If the images remain the same then the original images are displayed again, removing the need to download a second time. Perhaps the content has changed slightly with some updates news. This text is downloaded quickly, as text generally is, and the end-user experiencing a very fast and up to date Reuters front page.

A photographer site, with high-quality images that don’t change very often, would benefit greatly from the bandwidth saving features of caching. It would be a waste of resources to download the images, which will generally be of large file sizes for this type of site, every time the visitor looks at the page.

How does Web Caching Work?

Your browser uses a cache also and this is like a mini store of web items that the browser keeps on your computer. It’s used in case you decide to return to a site soon after first visiting. (Chrome is notorious for causing developers all kinds of problems by not displaying immediate updates to a site. A developer, or indeed anyone that needs the freshest version of a web page always should use a ‘clear cache’ plugin to refresh the cache at the click of a button).

The goal of caching your site

There are many goals but the main one is better site performance which leads to a higher ranking on Google. I’d imagine that nearly every site on the internet would want that. Bear in mind that site speed is one of 200 different ranking factors so it’s pointless to ignore the other factors in favour of your site’s PageSpeed results but we should also consider the visitor experience. A faster site will create a better experience for your visitors, meaning better visitor interaction and conversion, which results in better ranking.

W3 Total Cache

Let’s have a look at one of the most used performance optimizer tools available for WordPress, W3 Total Cache.
With more than 1 million active installs of this plugin, we can safely presume it does what it says on the tin: Increases server performance and a reduces download times.

W3 Total Cache does the job of storing data from previous requests to prevent re-downloading of the same data for further requests. It also compresses elements of your page and creates static files before they are sent to the browser, reducing the overall page size and increasing the speed of WordPress.

Before installing and configuring W3 Total Cache you should test your site using GTmetrix page speed tool to see what the current performance report for your website indicates. If it scores an A on PageSpeed then the improvements will be incremental but we can still look at other improvements. The Page Load Time value is something that can be still reduced significantly if it’s above 5 seconds. Note: this value depends quite a bit on the WordPress theme and also on the hosting provider but I’ve successfully reduced Page Load Times from around 8 seconds to less than 2 seconds on sites that were in the high ‘B’ and low ‘A’ PageSpeed score index.

Installation

To begin, make sure that you're not running any other caching software as this will cause conflicts.

Add the plugin as you would add any other plugin on WordPress.

In the Admin backend, hover over the Plugins menu and click Add New.

Search for W3 Total Cache, install and activate it.

The plugin will add another menu option to the Admin sidebar called Performance.

Hovering on this a second menu with your mouse produces a pop up showing several different configuration options for this plugin. W3 Total Cache installs with the basic options available to the plugin so a little bit of configuration is necessary to get the most out of it, but don’t be overwhelmed by all of the options. For most needs, there are just a few key areas that we need to look at.

w3 total cache plugin for wordpress

There are a couple of things to be aware of.

  • If you use CloudFlare then certain standard recommendations will not be used.
  • Changes to the minify settings (for compacting the stylesheets and scripts) can cause the formatting and features of your site to stop working. It’s good practice to check each individual change in the browser before moving on.

W3 Total Cache sections

  1. General Settings
    2. Page Cache
    3. Minify
    4. Database Cache
  2. Object Cache
  3. Browser Cache
  4. User Agent Groups
  5. Referer Groups
  6. Monitoring
  7. Extensions

General Settings

w3 total cache plugin options in wordpress admin

In WordPress Admin go to Performance -> General Settings. This is the overall settings configuration area for the plugin. Enabling options here can make sweeping changes across the site so we’ll look at what initial changes we should implement here and then look at more in-depth and granular changes.

General

The option to Toggle all caching types on or off (at once) should be ignored as it’s too general and can cause your website to stop working properly.
On this same display area, there’s an Enable button for the Preview mode which lets you check what your changes might affect before saving these changes.

Page Cache

The next section in General Settings is the Page Cache. This should be enabled and start off with the Disk:Enhanced method.

Minify

The Minify section can be a problematic one and if you are using CloudFlare this ‘general’ minification option should not be enabled. I’d recommend un-ticking the checkbox anyway and let's will focus on individual object minification a bit later. If GTmetrix tells you that your page contains render-blocking JavaScript in the theme then by adding the problem scripts to a list of embedded non-blocking files, available through the full Minify section later, we can help eliminate this problem. If this is the case then select the Manual Minify mode (second line option)

Database Cache

If using CloudFlare or another CDN leave the Database Cache option disabled. Many web hosts will recommend against using this feature so it’s worth testing thoroughly. If you’re using a SiteGround account (The choice of many small businesses, bloggers, and hobbyists) then the plugin developers recommend using the ‘disk’ method with caution. This basically means that the Database Cache option is prone to issues with only certain hosts. Test and evaluate!

Object Cache

Test changes to the Object Cache option against the results in GTmetrix (or Google Pagespeed Insights) and record the results so you can compare the before and after performance results. You may see some improvement with Object Cache optimization, but there’s a chance that degradation in performance occurs because of incompatibilities with the hosting or another plugin.

Browser Cache

This should be enabled in most cases.

CDN

If you’re using CloudFlare then leave this option disabled. If you a supported CDN (we recommend Rocket CDN by the creators of WP Rocket) then you can add it in here and configure it later with the CDN-specific tab on the Performance Plugin.

Reverse Proxy

Leave disabled

Monitoring

If you’re using the New Relic monitoring software then this setting can be configured here.

Licensing

The Pro version of w3 Total Cache includes extra performance boosts for users of the StudioPress Genesis Theme Framework and enhanced CDN support. Leave disabled unless you’re using the Genesis Theme and want to spend the $99/year on this service.

Miscellaneous

If you would like to use the Google PageSpeed dashboard inside the plugin then you’ll need to get an API key from the developer’s console. I would leave this disabled for now and come back to it when you’ve configured everything.
Verify rewrite rules should be enabled.
Disable Enable file locking.
The Optimize disk enhanced page and minify caching for NFS option should be tested before applying permanently. Half of the experts and webmasters recommend using this option and the other half recommend against using it. Test both situations before deciding.

The Debug section is useful for testing purposes and the Import/Export settings option is used for saving a good configuration or importing another one.

Now let’s look at the individual performance tabs that make up the W3 Total Cache plugin.

Page Cache

Set these options as follows.
Cache front page – Enable
Cache feeds: site, categories, tags, comments – Disable
Cache SSL (https) requests – Enable if using SSL. You could also leave this enabled even if not using an SSL.
Cache URIs with query string variables – Disable
Cache 404 (not found) pages – Disable
Cache requests only for the mydomain.com site address – Enable
Don’t cache pages for logged in users – Enable
Don’t cache pages for following user roles – Enable

For the Cache Preload section, I’d recommend leaving Automatically prime the page cache enabled and make sure to add a sitemap to the Sitemap URL. This is quite an important part of the plugin. It’s sort of like an automatic cache system that will speed up the site for the first user to a page. The cache is set up after a specified interval and so automatically kicks off the process that would normally happen on the first request of a page by a visitor.

The Purge Policy:Page Cache settings are by default generally set to optimum for most sites. The default settings tell the Page Cache to purge if the front, post, and blog pages are changed. This makes sense as we’d want these pages refreshed after any changes. The other elements are not as important and can be left disabled.

In the Advanced settings, there is really only one setting to experiment with. Many people will argue against using the Compatibility Mode feature as it can reduce performance but it has several advantages. Your WordPress installation might work more efficiently with your hosting plan if this is enabled. I’d suggest testing enabling this and testing performance.

Minify

If you’re using CloudFlare then there’s no need to enable minify options as CloudFlare takes care of this with it’s Auto Minify options. Using both together could cause issues. If you’re not using CloudFlare then read on.

General

Rewrite URL structure – enabled
Disabled minify for logged in users – disabled

HTML & XML

To start off with tick all boxes in the HTML minify settings except for Line break removal. Test your site to see if any formatting issues arise and debug by deselecting the Inline CSS minification and Inline JS minification options in turn if you’re having problems.

JS

This section has caused me more problems than any other so I’d advise thorough testing. Minifying JavaScript files can result in strange behaviour on your web pages.
I’d recommend enabling this setting but watching out for any issues.
If GTmetrix or Google PageSpeed results tell you that you have render-blocking JavaScript then try changing the Embed type to Non-blocking using “async” and add the scripts to the list. This is a procedure that I will discuss in a future post.
The defaults for the rest of this section work fine in almost all cases.

CSS

This setting can cause similar problems to the JS setting above. Enable and test, that’s the golden rule here.
Select Enable and Line break removal.

The @import handling feature deals with the way CSS files are dealt with on web pages. @Import is used to import one CSS file into another. We can make this process smoother and faster by setting the @import handling to Process.

Advanced

In this section, there’s not a whole lot to do unless you want to specify that certain CSS or JS files are not minified if using the auto-minify option

Database Cache

WordPress relies on database queries to display the content you have created. Your posts, images, and pages are all stored in a database while the structure of the page is kept separate and can be upgraded, deleted, or changed without affecting the database entries. Database caching allows WordPress to serve up information without hitting the database by caching information that is regularly accessed. If something has changed in the backend then the plugin will figure this out and serve up the new information. If the information hasn’t changed then the cached version will be available to avoid extra bandwidth usage.

Make sure Don’t cache queries for logged in users is selected. Everything else can be left as default.

Object Cache

A word of warning for people on shared hosting, test this feature (enable and disable through the General Settings section) before finishing your review of the plugin, as it might cause unwanted issues with your site.

Browser Cache

In the General section, I recommend selecting all options except for the last two.

The CSS & JS, HTML & XML, and Media & Other Files sections don't require much configuration if the default settings are enabled. Leave the defaults but enable HTTP (gzip compression) on each.

Under the General section check the following boxes

  • Set Last-Modified header
  • Set expires header
  • Set cache control header
  • Set entity tag (ETag)
  • Set W3 Total Cache header
  • Enable HTTP (gzip) compression
general settings browser cache w3 total cache

Under the CSS & JS section check the following boxes

  • Set Last-Modified header
  • Set expires header
  • Set cache control header
  • Set entity tag (eTag)
  • Set W3 Total Cache header
  • Enable HTTP (gzip) compression
js & css cache settings

User Agent Groups

This is an advanced section and the theme of a future blog post. If you want to cache mobile and tablet responsive layouts differently to how the desktop site is cached then you would set up User Agent Groups to deal with this. However, if your site only uses CSS and Javascript to modify the layouts in a responsive manner there is no requirement for this option. I have seen a few people recommend enabling these options without looking into any possible performance issues. Arbitrarily enabling settings in any plugin is a recipe for a slow and broken site. Leave the defaults if you’re not sure.

Referer Groups

This is an interesting option to examine at a later stage. Most people will not use this feature but if you wanted to redirect people coming from (referred by) Yahoo search engine to one display version of your site and people coming from Google to another you can set up the options here. Leave disabled for the purposes of this performance review.

CDN (Content Delivery Network)

A CDN is a Content Delivery Network which is a valuable asset for reducing the overall load on your servers. If you’re using CloudFlare for this purpose then leave this setting disabled. If you are using MaxCDN, KeyCDN, Amazon CloudFront or another service you can enter all the details here. A future post will explain the various options available.

Setting up CloudFlare with W3 Total Cache

Grab your API key from the sidebar on CloudFlare's administration panel.

Click here to go straight to the API key section in your CloudFlare account.

Click View in the Global API key row.

Back In the WordPress admin panel, go to Performance > Extensions and click Activate under the CloudFlare option.

Once CloudFlare is activated you will be able to click Settings under CloudFlare.

This will bring you to the Credentials page where you need to authorize your account. Click Authorize beside “Specify Account Credentials:”

Enter your email address and API Key

Select the Zone, which is probably the name of your website domain and click Next.

Turn on the Cloudflare JS, HTML, and CSS Minify settings

Click Save Settings & Purge Cache.

Monitoring

New Relic is an excellent service that allows you to monitor your website for issues arising in the database, the backend server, the code, plugins or another external service. You can monitor user interactions and find out where customer flow is falling off. Data and analytics are key factors in determining the quality of the user experience on your site so it’s worth investing in one of the better tools around for this purpose. Leave disabled if you don’t use New Relic.

Extensions

This is fairly easy to understand but as the defaults are all disabled it’s worth checking and enabling any options that you will use.
Obviously, if using CloudFlare the CloudFlare extension should be enabled here.
Activate Feedburner
For users of StudioPress themes you can get a (developer-claimed) 30-60% increase in speed by using their extension. This is already an extremely fast theme so there's quite a speed improvement to be gained by using this combination.
I’d highly recommend using Yoast so if you have this excellent plugin installed, activate the extension here.

Alternative cache and complementary tools

WP Rocket

An alternative cache for WordPress is WP Rocket, one of the best paid caching plugins. WP Rocket offers a few things that W3 does not. You can see the full list of features and comparisons on the WP Rocket Features page.

Perfmatters

Perfmatters can work alongside W3 Total Cache by handling aspects of performance optimization. While W3 Total Cache focuses on caching, Perfmatters offers additional optimization features such as disabling unnecessary WordPress features, optimizing scripts and databases, reducing HTTP requests and more, which can lead to even faster loading times and improved user experience.

Summary and Conclusion

W3 Total Cache is an excellent plugin that will help you squeeze a lot more speed from your WordPress installation. The basic configuration will give you some performance boost but a complete configuration can see those efforts doubled.

Some points to keep in mind when performing performance reviews on your site

  • PNG should be used for logos.
  • JPEG should be used for photos.
  • Ads will slow your site down so always think about this when considering putting advertisements on side-bars or headers.
  • Use caution with social sharing plugins such as the Jetpack Sharing feature. Facebook like buttons and Twitter feeds can also seriously impact download times.
  • Keep analytics scripts, affiliate links, and other scripts to a minimum.
  • It’s worth testing your WordPress theme in the demo version online before purchasing or downloading as it might show you some inefficiencies in the theme’s code.
  • Sliders and full-screen auto-play video will add significantly to the server load. Only use sliders and video if absolutely necessary.
  • Be sure to perform full tests on Photon, the plugin that comes with Jetpack for WordPress, at the same time as another CDN, or caching system. I don't recommend it and I’m sure many people would disagree with my view. The truth is that it’s not a very versatile plugin, it’s not a real CDN, and it can have issues with many other plugins.
  • Remember to empty the cache whenever you make changes. A dialogue box appears at the top of the WordPress Admin page whenever you change anything in W3 Total Cache indicating that changes have been made and asking if you want to empty the cache. Do this before testing the site in your browser.

If you have questions regarding the use of the W3 Total Cache Plugin or how to speed up WordPress please let me know in the comments or reach out on Social Media.

w3 Total Cache - How to Set it Up
Speed up WordPress with a web cache

Marketing Nuggets Newsletter: Advice, Tips, News & New Blog Posts

Get a curated list of the lastest posts on Fat Frog Media and marketing tips from around the web.
A couple of times a month. Free. Packed full of good stuff.

Scroll to Top