Wordpress

Ultimate Guide to Speed Up WordPress with W3 Total Cache

The load time of a website counts very much. If your website loads very slowly then surely visitors are not going to come back. Google also states that faster the load time, the faster will google search engine response to your webpage indexing. There are generally a lot of factors which actually render your site quite slowly, but I am not going to discuss them here. You are lucky if you are using wordpress as your blogging content management system, because there is a very super cool and efficient caching plugin available for the wordpress which makes the wordpress powered site to load quite fast.

This tool is a plugin used by a lot of bloggers already, its W3 Total Cache plugin for wordpress. This plugin will surely speed up your wordpress if you configure it correctly and know about how to use it. This article will help you to setup w3 total cache in order to speed up your wordpress.

W3 Total Cache to Seped up WordPress Website and Blogs

Installing W3 Total Cache in your WordPress:

The firs step is to install w3 total cache by going to the plugins menu in your wordpress dashboard. From the side menu just open Plugins >> Add New. There in the search field write “W3 Total Cache” and search for it. Search will look like this:

Install w3 total cache - speed up wordpress

Since, I have already installed the plugin, so you just need to click the “Install” button to have it on your wordpress site. After installing the plugin just activate it.

Configuring W3 Total Cache for your WordPress blog to speed it up and reduce website’s loading time:

There are certain basic settings which you need to do in order to take full advantage of W3 total cache.

Page Cache:

The first setting you can see in the “Performance” menu is “Page Cache“, just open it up. A lot of settings are pre done by default but you mus take care about the following settings:

  • Tick: Cache Front page.
  • Tick: Don’t cache pages for logged in users, also Don’t cache pages for users with role administrators.
  • Give sitemap url in the cache preload box.
  • In purge policy cache tick Front page, blog page and the Blog Feed. Below check your blog feed mostly its rss2.
  • Set Garbage collection interval to 3600 and comment cookies lifetime to 1800.
  • In advanced settings box, write this in Non-trailing slash pages:
sitemap(_index)?\.xml(\.gz)?
[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?

Minify:

Minification is good if you want more speed from webpage. It will speed up your site efficiently by decreasing the size of the code being used. Do the following settings and leave the rest as before:

  • Tick: Rewrite URL structure.
  • Tick: Disable minify for the logged in users.
  • Select admin to to receive the minify error notifications. Some hosts do have some errors for modification but this works well with a centOS hosting.
  • Tick everything in the HTML Minify Settings, like Enable, Inline CSS minification, Inline js minification etc.
  • In ignored comments stems you must have “google_ad_” and RSPEAK_ since these are the tags which will be ignored while minification.
  • In Js minify settings, just select minification for every type of script whether that is in head body or the footer.
  • Enable the CSS minification settings (Untick combine only) and in the advanced menu select update external files every 21600 seconds.

Database Cache:

Leave the default settings for the database cache and make sure, the database isn’t being cached for the logged in users. There is a tick untick settings for this option under database cache section of w3 total cache. This database cache actually reduces the query time of posts, comments or pages. It reduces time for anything being fetched from the database by making a cached copy of the request and then next time serving the user with that fast cached copy.

Object Cache:

Object cache is really good since it never makes the wp_options query hit the database, instead the query reply comes from the object cache api and thus making the whole page load quite faster. Do the following settings in the object cache:

  • Default Life time of cache objects: 180 seconds
  • Garbage collection interval: 3600 seconds
  • Leave rest of the settings as default

Browser Cache:

Really important to be implemented because to help increase your wordpress site speed up, there must be intensive client side browser cache which will help the user load the site in seconds after the first visit to site. As browser cache stores the cache of the static object after the first loading of site and hence making the site to load quite fast the next time. Do the following settings here:

Tick Everything Except:

  • General: Set Cache Control Header
  • General: Disable cookies for static files
  • CSS and JS: Set Cache Control Header
  • CSS and JS: Disable cookies for static files
  • HTML and XML: Set cache control header
  • Media and Other Files: Set Cache Control Header
  • Media and Other Files: Disable cookies for static files

Set Following additional settings in Browser Cache:

  • Media and Other Files: Expired Header Lifetime: 31536000
  • CSS and JS: Expired Header lifetime: 604800
  • Select second option in Cache Control policy (For Every Field)

Incase, you don’t want to use Gzip compression for text files, here is a guide which shows how to enable Brotli Compression on W3 Total Cache.

User Agents Groups:

This is something really cool, though I never implemented it. Actually, this can also help you to increase the load time of your wordpress website and ultimately will help in decreased load time. You can select some of the users with a specific device to show them the website with your custom template designed for mobile along with redirection options also. You can play around with it and can change the settings to meet your needs.

Referrer Groups:

You can change the settings about how you website gets displayed to the certain referrers. This is typically the same thing described above, but it applies only to the referrers. Like people coming from different search engines and other sources.

CDN – Content delivery network:

You can setup a CDN network for your website. A CDN is something which serves you the static files of your website from another fast loading server like MaxCDN, Amazon CDN etc. It helps to decrease the load time of site and as a result making your wordpress site speed up.

You can also setup a custom CDN to server your content from another subdomain of your website like cdn.talkofweb.com etc. This will help you to reduce the load time of website. I will publish an article soon teaching you to setup own custom cdn.

Activating Every configured Feature of the Plugin:

You have done every possible setting now, now just you need to activate everything. Thus, you are just one step behind speeding up your wordpress.

General Setting w3 Total CacheJust navigate to the w3 total cache general settings, and there just activate the configured modules of the w3 total cache. Like, tick Page Cache, Minify(Minify cache mode: disk | Minify Mode: Auto | Js Minifier: JSMin , Rest Keep Default) , Database Cache, Object Cache, Browser Cache, CDN (If you have attached a CDN Network before in settings) and Just click “Save all settings“.

You can also integrate cloudflare with the w3 total cache. I’ll cover that in another post, that also comes in the CDN section.

How to online check the page load time?

There are a lot of tools available online which can help you to analyze your page load time. There are two tools which I shall recommend you to analyze your page load time before activating and setting up w3 total cache and after setting it up, to check the difference and positive impact on the website loading speed:

Pingdom Tools

Google Page Speed Test Tool

3 Comments