How to set up W3 Total Cache caching for WordPress

How to set up W3 Total Cache caching for WordPress

Author: HostZealot Team
2 min.

One of the most difficult plugins in terms of configuration is W3 Total Cache. At the same time, it is extremely useful for all WordPress sites, as it significantly increases the speed of the resource, reduces its loading time, and reduces the overall server load. After spending a little time studying this material, you will be able to figure out how to configure the W3 Total Cache caching plugin for WordPress.

How to install W3TC

Everything is as usual: through the admin panel, go to the "Plugins" tab and add a new one – through the search, we find W3 Total Cache and connect it. Before installing, be sure to remove any other caching plugins if you have used something similar before.

Basic settings of W3 Total Cache

In the left menu of WordPress you will see the Performance tab – go there and click on General Settings. Here we will go through the main points that need to be configured:


Preview mode – enables or disables preview mode. When this option is active, the plugin works only for the user who configures it. It will be useful for those projects that have been online for some time and have accumulated some traffic.

Page Cache

The most important option, the inclusion of which activates the caching mode of web pages. This, in turn, reduces the server response time and increases the page loading speed.

Also here you can choose the method of caching site pages in the Page Cache Method item. We recommend installing Disk: Enhanced, since in this case the cache data will be stored on the server drive – as a rule, it is an SSD. Solid-state drives are extremely fast, so they are ideal for cache storage – reading this data will take fractions of seconds, so the benefits of the technology will be felt even more. You can also choose the method of storing the cache in RAM – it is even faster, but this is very wasteful since RAM is expensive and its volumes are limited. The method of caching using RAM is suitable only if your server has an excess supply of RAM.


Here we have 3 items that require setting up:

  1. Minify – activates the minification of the file code. The minification process involves reducing the size of the source code by removing unnecessary characters and comments without compromising functionality. In practice, it provides an increase in site loading speed by compressing CSS, JavaScript, and HTML.
  2. Minify mode is recommended to be set to Auto, since in this case W3 Total Cache will independently determine the files that need to be optimized in terms of code, and will also automatically set the order of file connections.
  3. Minify Cache Method – caching method. As in the case of Page Cache, the recommended value will be Disk – provided that you have an SSD or NVMe drive installed on the server.

As for the HTML minifier, JS minifier and CSS minifier items, the default value will be recommended for all three.

Opcode Cache

An option that activates caching of compiled PHP code. We recommend installing Opcode: Zend Opcache, as this is the best option for VPS. There is also a Validate timestamps item here – we mark it with a checkbox so that the cache is updated correctly without having to restart the PHP module.

Database Cache

Enables caching of database requests. In practice, it reduces the time for generating website pages, and is an excellent alternative to an object cache when, for some reason, the latter cannot be used. You can use both technologies in parallel.

In the same tab, you can select Database Cache Method – Memcached will be recommended. We have a separate article about Memcached technology, we recommend reading it. In general terms, this technology allows caching data in RAM based on hash tables.

Browser Cache

This item is responsible for client caching, which speeds up the loading of sites upon repeated request by caching graphic elements, CSS and JavaScript.

Page Cache

These are the page caching settings, which can be accessed by going to the path Performance > General Settings. Here we are primarily interested in the General tab with such items:

  • Cache posts page — caching of record pages.
  • Don't cache front page — disables the cache of the main page, provided that it is static.
  • Cache feeds: site, categories, tags, comments — caching feeds (categories, tags, comments, etc.).
  • Cache SSL (https) requests — caching of unique SSL requests. It is recommended for those whose website operates on the basis of the https protocol.
  • Cache URIs with query string variables — caching pages with parameters in the URL A useful option for online stores with a product filter, as well as for websites whose users often use the built-in search.
  • Don't cache pages for logged-in users — disables caching for authorized users. Allows you to optimize the cache and reduce the load on the server, it is recommended to leave it activated.
  • Don't cache pages for following user roles — disable caching for selected user groups. It is recommended to activate it for accounts that manage the site.

Cache Preload

Here you can set the interval between cache updates, as well as specify the number of pages that will be cached at specified intervals. The higher the server capacity, the more pages should be specified, but you can only determine the optimal figure for your site by experience.

how to set up w3 total cache caching for wordpress

Purge Policy: Page Cache

In this block, you can configure the mechanism for clearing the cache when creating and editing records, as well as when publishing comments. It is best to leave the default values.


In the advanced settings, the field of interest is the Garbage collection interval, since here we can set the interval for clearing the cache on disk. The higher the workload of your project, the lower the value should be set – this will allow you to get rid of the expired cache in a timely manner so that it does not overload the file subsystem.


Here we can configure the minification of HTML, XML, CSS, and JavaScript. To begin with, go to General and activate the following options:

  • Rewrite URL structure – allows you to disable GET parameters for links;
  • Disable minify for logged-in users – with this option, you can disable the loading of compressed pages for users who have been authorized;
  • Minify error notification – setting up error alerts when generating a minified cache.


In this block, we can configure the minification of the HTML code of the site pages. As practice shows, you will not get a serious performance gain from compressing HTML code, but activating this option can lead to problems with layout. Use at your own risk.


It contains minification settings for JavaScript files. To activate the option, check the box next to Enable. Next, you can set script loading parameters for different areas of the HTML page. The optimal value is Default. You should also choose a minification mechanism – it is best to put Combine only.

All other settings in this section can be left untouched.


Activate the W3 Total Cache minification, check the box next to Combine only, and do not touch anything else, there is no need.


Here you can specify advanced minification parameters. We need two parameters:

  • Update external files every – the time interval between downloading and updating external files in the minified cache;
  • Garbage collection interval — the interval for clearing the minified cache.

If you have a highly loaded project, the second parameter should be set with the lowest possible value. This will reduce the server load and increase the efficiency of the cache.

Browser Cache

This page contains the browser cache settings, and for most cases you can leave the values that are set by default.

Connecting Google Page Speed to W3 Total Cache

To enable Google Page Speed, you need to check the box next to "Enable Google Page Speed dashboard widget". Then you need to click on the "API key here" and paste it into the appropriate field. The key itself can be obtained on the official website. After saving the settings, go to the Debug section and disable all debugging options, since activating them only adds unnecessary code to your site. For the purpose of optimization, we disable it.

Related Articles