WordPress Core is somewhat lacking when it comes to using caching systems to decrease site load time and use of server resources. Luckily, there are a few best plugins available in the WordPress repository; one of them is WordPress W3 Total Cache plugin that helps to make websites load faster using caching rules.
Using caching mechanism on the WordPress site ensure enhanced user experience by reutilizing the data user has already requested to by making use of browser caching. Due to caching, files are instantly available which makes a website to load faster.
On Cloudways, each new install of WordPress instance comes with preconfigured Breeze, our custom developed WordPress cache plugin. But, if you still want to use W3 Total Cache as it is also compatible with our managed cloud hosting stack, then this guide is for you. (You may also use other WordPress cache plugins with similar settings.)
In this guide, we will show you how to use WordPress W3 Total Cache plugin on your website with some recommended W3 Total Cache configurations to get the most out of it.
- Install WordPress W3 Total Cache Plugin
- How to Use WordPress W3 Total Cache Plugin?
- General Settings
- W3 Total Cache Configuration of Cloudflare
- Breeze – WordPress Cache Plugin
Install WordPress W3 Total Cache Plugin
Log into your WordPress dashboard and navigate to Plugins → Add New and search for W3 Total Cache.
Install and Activate the plugin to configure W3 Total Cache settings. You can also install the plugin manually if you have downloaded the plugin file. In that case, you may use FTP access provided by the Cloudways platform.
First, we will overview the W3 Total Cache settings we have available. For beginners, the settings might be confusing, so it is useful to know exactly what each option does.
How to Use WordPress W3 Total Cache Plugin?
Assuming you have installed and enabled W3TC on your WordPress website, you will see a new option in the Admin sidebar i.e. “Performance” under the General Settings tab. You will see different types of caching that can be enabled or disabled. Each widget type of area holds general settings for the caching and the type of caching method to be used.
From the dashboard, you can perform a few quick actions like:
- Compatibility check
- Empty different kind of caches
Before moving ahead, do not forget to perform a compatibility check that will display the Server Modules & Resources installed, and enabled/disabled. This will give you an idea of how well the W3TC can perform according to the resources you have, not only this, it will also show you the software that may need to install to get the advantage of more W3TC features.
In this mode, you can Enable preview mode before actually saving the caching settings. And this section also has the option for Save Settings and Purge Caches which can be used to flush the existing cache.
In our today’s W3 Total Cache Configuration guide, we will configure the settings mentioned in the General Settings tab.
The page cache creates copies of your previously visited WordPress posts/pages. If it is not enabled, then on each page view on your site WordPress generates the page content by executing PHP and sending queries to the database.
When this setting is enabled, a cached version of the page is served to the visitors. It reduces the page load time and also decreases the load on server resources, hence increasing your server’s capability to handle more traffic.
For example, the header or the footer of a site do not change so frequently and does not require a fresh copy from the server every time user goes back to the same page. The copy of the static file is stored in a user’s browser and is served when requested again.
The suggested Cache method is Alternative PHP Code on both PHP 5.6 and PHP 7.
Advanced Page Cache
If you are an advanced user, navigate to the Page Cache from the left W3TC (Performance) menu and configure W3TC page cache as per your requirements.
As the name suggests, this option enables minification of your CSS, JS and HTML files. This isn’t a caching setting and will behave differently on different WordPress setups.
Minification is the process of eliminating unnecessary spaces, comments, and indentation from the files so that space can be saved and reduces the overall file size. These are the files responsible for viewing and other user interactivity and if not delivered fast enough, it can harm the user experience.
We suggest you test it separately on a WordPress staging site before. In some cases, it will harm your website’s performance because the process of minification is server intensive.
The suggested Cache method is Alternative PHP Code on both PHP 5.6 and PHP 7.
If you are an advanced user, navigate to Minify from the left W3TC (Performance) menu and configure W3TC Minification as per your requirements.
Caching the database queries will reduce the load on your server, hence server will have more resources to serve the website to the incoming flow of traffic.
In this type of caching, frequent queries are cached and utilized when the user makes the similar request over and over again. This saves the trip of searching all the tables inside the database and bring back the required result faster.
This will be particularly useful if you have a WordPress website that sends out a lot of database queries per page load.
The suggested Cache method is Memcached.
Advanced Database Cache
If you are an advanced user, navigate to Database Cache from the left W3TC (Performance) menu and configure W3TC Database Cache as per your requirements.
Object caches are particularly useful for database intensive websites. Cloudways integrated Redis on their servers some time ago, you need to install it by going to the Servers → Settings & Packages → Packages and then click on install Redis and then Enable Object Cache here. We have written an extensive guide to add Redis on WordPress.
The suggested Cache method is Redis.
Advanced Object Cache
If you are an advanced user, navigate to Object Cache from the left W3TC (Performance) menu and configure W3TC Object Cache as per your requirements.
Browsers these days cache the static content of websites to improve the user experience. In the W3TC option of browser cache, you can enable/disable it. Additionally, you can add exceptions and expiry dates of the elements.
We suggest you enable it and then navigate to the Browser Cache tab and enable the following settings for maximum effect.
- Set Last-Modified header
- Set expires header
- Set cache control header
- Set entity tag
- Set W3 Total Cache header
- Enable HTTP (Gzip) compression
Browser cache is important especially if your site has regular visitors. The static content is already cached in their browsers as per the rules you have implemented in settings. Only the updated content is loaded from the server which makes the whole website load faster and saves bandwidth.
Advanced Browser Cache
If you are an advanced user, navigate to Browser Cache from the left W3TC (Performance) menu and configure W3TC Browser Cache as per your requirements.
Content Delivery Networks for WordPress have become popular, especially for websites that get traffic from all over the world. CDNs, like MaxCDN and Cloudflare, are popular and you can easily integrate them with your WordPress website through the W3TC plugin.
CDNs serve the static content of your website from different locations rather than just your WordPress hosting server. This helps in reducing the load on your server and improves the speed at which the website is served to visitors coming in from different locations.
This is highly recommended for higher traffic websites targeting the global audience. CDN like Cloudflare which is also compatible with W3 Total Cache has over 150+ data centers across the globe. These networks create a copy of your website and serve through its server rather than going back and forth to the web host for every request a user makes.
Advanced CDN Configuration
If you are an advanced user, navigate to CDN from the left W3TC (Performance) menu and configure W3TC CDN as per your requirements.
Cloudways servers come with pre-installed Varnish cache. Varnish is a very powerful cache that caches entire content (that can include both static and dynamic content of your website) and serves that content to returning and even new visitors. This cache speeds up the HTTP requests and sits in front of Apache (web server).
In W3TC the Reverse Proxy setting is used to purge the Varnish cache whenever you make an update to your website. It is highly recommended to keep it enabled or else you would need to purge Varnish manually each time.
If you use New Relic with WordPress, then you can connect it with your website just by entering the API of New Relic of your account.
But this is not required as Cloudways servers come with a built-in New Relic account that you can access under the Server Management → Monitoring → Application.
New Relic is an application performance monitoring tool which gives you an insight into how well your application is working and identify the spots which are causing performance related issues.
If you want support from the developers of this plugin and configuration guide, then you can purchase and verify your license key here.
Under this tab, you will find general options that you may want to use as the Google Page Speed dashboard. We suggest keeping the “Verify rewrite rules” and keeping other options unchecked.
Debug mode is particularly useful if you want to know which cache is working and how much effect it has on the pages. To view the debug information, view the source code of your website and navigate to the end of the page. You will see the comments notifying you if a cache is enabled, how many queries were cached, and how long it took to build the cached page.
If you have a lot of websites and don’t want to go over the same process of setting up W3TC over and over again, you can easily export all your settings and import the settings into your other website.
W3 Total Cache Configuration of Cloudflare
If you intend to use Cloudflare CDN using W3 Total Cache plugin then head over to Extensions tab and assuming that you already have set up Cloudflare for WordPress, simply activate the Cloudflare plugin → go to plugin’s settings and provide your email and API key for authorization.
Once authorization is completed you will be able to configure Cloudflare using W3TC plugin.
Breeze – WordPress Cache Plugin
Breeze is a free and user-friendly WordPress Caching Plugin developed by the Cloudways team. It offers various options to optimize WordPress performance at various levels. It works equally great with WordPress, WordPress with WooCommerce and WordPress Multisite. This is a lightweight plugin with features targeted towards a faster website.
Today, we have learned how to set up W3 Total Cache for a better page loading time. There are many advanced settings that you can tweak to better optimize the WordPress website using W3 Total Cache Plugin. It all depends on various WordPress setups. Keep in mind that you could mess up the settings, which is why using the suggested settings will prove to be most useful for you. However, if you still want to experiment with various caching combinations; I suggest you take a full backup of your site.
Be the first to check out WordPress 5.0
Use our Staging feature before upgrading your website to WordPress 5.0.