WordPress caching: W3 Total Cache setup guide

Caching is a process in which document such as image, html pages are stored temporarily to reduce load on server and make page loads fast. Speed plays an important role in the life of any website, it can affect your search rankings and it can have a huge affect on user experience.

You can see how fast howlthemes loads, its because we are using W3 Total Cache and off course Nginx server provided by DigitalOcean. WordPress core does not perform well on its own. To improve its performance we can add caching rules on various elements of the website and at the server level. The most easiest way to add caching to WordPress is by using plugins, and one of the most popular is W3 Total Cache, this plugin guarantee to at least 10x improvement in overall site performance.

Install W3 Total Cache

To install W3 total cache plugin follow below steps:

  1. login to your WordPress dashboard.
  2. select plugins >> add new from admin menu.
  3. in search box enter “w3 total cache” and install it.

Basic W3 Total Cache settings :

After installing and activating the plugin you will see performance tab added in your admin menu. Now I will tell you what settings you should enable and explain benefits of each.

General Settings

  • Enable Page Cache and select Disk: Enhanced method.
  • Enable Minify set mode to manual and make Disk minify cache method. In some cases minify break the theme so just disable it in that case.
  • Disable database cache, enabling database caching is not recommended because in some case it breaks functionality of some plugins.
  • Enable object cache, it increases performance of dynamic websites. Object cache method should be Disk.
  • Enable browser cache.
  • Enable CDN, it is highly recommended. It decreases load on server and increases uptime.

Advanced W3 Total Cache settings :

Now we are going to configure more advance settings, follow the below instructions:

Page Cache

Access page cache setting by going to Performance >> Page Cache

Page Cache- General

  • Tick cache front page.
  • Tick cache feeds.
  • Tick cache SSL (https) requests.
  • Untick cache URIs with query string variables.
  • Tick cache 404 (not found) pages.
  • Tick cache requests only for www.howlthemes.com site address
  • Untick don’t cache pages for logged in users.
  • Tick don’t cache pages for following user roles

Page Cache- Cache Preload

  • Tick automatically prime the page cache.
  • Change update interval to 11000 seconds.
  • Enter your sitemap URL.
  • Tick preload the post cache upon publish events.

Browser Cache

Access browser cache setting by going to Performance >> Browser Cache

Browser Cache- General

  • Tick Set Last-Modified header.
  • Tick Set expires header.
  • Tick Set cache control header.
  • Tick Set entity tag (eTag).
  • Tick Set W3 Total Cache header.
  • Tick Enable HTTP (gzip) compression.
  • Untick Prevent caching of objects after settings change.
  • Untick Don’t set cookies for static files.
  • Untick Do not process 404 errors for static objects with WordPress.

Browser Cache- CSS & JS

  • Tick Set Last-Modified header.
  • Tick Set expires header.
  • Set Expires header lifetime: 31536000 seconds.
  • Tick Set cache control header.
  • Tick Set entity tag (ETag).
  • Tick Set W3 Total Cache header.
  • Tick Enable HTTP (gzip) compression.
  • Untick Prevent caching of objects after settings change.
  • Untick Disable cookies for static files.

Browser Cache- HTML & XML

  • Tick Set Last-Modified header.
  • Tick Set expires header.
  • Set Expires header lifetime: 3600 seconds.
  • Tick Set cache control header.
  • Tick Set entity tag (ETag).
  • Tick Set W3 Total Cache header.
  • Tick Enable HTTP (gzip) compression.

Browser Cache- Media & Other Files

  • Tick Set Last-Modified header.
  • Tick Set expires header.
  • Set Expires header lifetime: 31536000 seconds.
  • Tick Set cache control header.
  • Tick Set entity tag (ETag).
  • Tick Set W3 Total Cache header.
  • Tick Enable HTTP (gzip) compression.
  • Untick Prevent caching of objects after settings change.
  • Untick Disable cookies for static files.

This settings will fix Leverage browser caching error which site gets in Google pagespeed insights.

Minify

Access minify setting by going to Performance >> Minify

Minify- General

  • Tick rewrite URL structure.

Minify- HTML & XML

  • Enable HTML minify settings.
  • Tick Inline CSS minification.
  • Tick Inline JS minification.
  • Tick Hide comments.

Minify- JS

  • Enable JS minify settings.

Minify- CSS

  • Enable CSS minify settings.
  • Tick Remove unnecessary backslashes.

That’s it. This settings should boost your WordPress site speed, if you face any problem please comment below.