Few months ago, we talked about how you can speed up the load time of your WordPress blog by using the W3 Total Cache plugin. We know that some of you might be confused on how to configure the plugin settings in order to maximize the benefits, that’s why we have decided to create a step by step guide to installing and setting up W3 Total Cache for beginners.
What is W3 Total Cache?
W3 Total Cache is the fastest and most complete WordPress performance optimization plugin. It is trusted by many popular sites including: mashable.com, smashingmagazine.com, yoast.com, WPBeginner and more. W3 Total Cache improves the user experience of your site by improving your server performance, caching every aspect of your site, reducing the download times and providing transparent content delivery network (CDN) integration.
Installing W3 Total Cache Plugin
Go to your WordPress admin panel, click on Plugins > Add New, and then search the name “W3 Total Cache”. You should see result like the image below, install the plugin and activate it.
Note: Before you install W3 Total Cache plugin, make sure that you uninstall all other caching plugins such as WP Super Cache. If you do not do this prior to installing, the plugin will have issues upon activation.
Having File Permissions Errors?
Assuming you’ve downloaded and tried to activate the plugin, you may find a slew of errors appearing related to permissions. Tackle them one by one as the plugin instructs and you should be fine.
1. WP-Content is Not Writeable
Log into FTP and change the file permission information for the folder “wp-content” to 777
2. Unable to Edit WP-Config.php
Open the file and add the line as the instructions specify. This turns on WordPress built-in caching abilities that W3TC needs to work.
define(‘WP_CACHE’, true); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . ‘wp-settings.php’);
3. .htaccess is Not Writeable
Again, temporarily change the file permissions to 777 via FTP. The plugin will also give you a helpful reminder to change the wp-content permissions back once you’re done.
Bear in mind that when preview mode is enabled, the changes won’t occur until you click “deploy” or you can just turn on preview mode and work with the site live.
Click on “compatibility check” button to determine what W3TC can actually do for you. If you found some functionalities are not being installed. Here are some helpful tutorials on how to fix those issues.
Now that we have some caching abilities set up and the plugin installed and activated, let’s look at settings and configuration of the plugin.
Settings and Configuration of W3 Total Cache
Go to General Settings page, you will see an option to enable or disable preview. You should click disable, so the site is actually running W3 Total Cache rather than just previewing it. So your final screen would look like this:
Next option on the screen will be Page Cache. This section is responsible for creating static cache pages for each page that is loaded, so it is not being dynamically loaded upon each page load. By having this enabled, you will significantly decrease your load time. For Shared servers, which most users are using, the Disk (Enhanced) Method is highly recommended. Your final screen result should look like this:
After the page cache, you should see the option for Minify in the general page. Minify is the famous technique of reducing the size of your CSS files, JS files, HTML files, posts, pages, and RSS. What this does is remove the unnecessary objects that your users do not need to see. Disk is the only / best option for shared servers. Your final screen should look like this:
Next option is Database Cache. This is crucial for site load time because WordPress sites are entirely running on database. Often high load of database queries are the cause that slows yours site down and/or crash the site upon high traffic. The Database Cache option will cache queries such as pulling the twitter count from your database, if you are using that. This option can essentially speed up your site by 100x. Your final setting for this area would look like this:
Object Cache is the option that comes next. This increases the performance of highly dynamic sites that uses the Object Cache API. The final settings should look like this:
The next option after this is for Content Delivery Networks (CDN). W3 Total Cache supports MaxCDN, NetDNA, Amazon S3, Rackspace Cloud, and Amazon Cloud Front. Enable it if you think you will be using CDN, otherwise just leave it unchecked.
The next option after this is for Browser Cache. Browser Cache enables HTTP compression and adds expiration headers on the objects of your site. Each time a user visits your site, their browser stores a copy of your site, so on the next visit, your user does not have to re-load the site entirely (which speeds up the load time). But each browser resets the cache on their own schedule even when the file has not been changed. By enabling this, your site will tell the browser how long to hold each object. For example, you don’t change your favicon every day, or even month. That is something can be stored for one month period without change. The final screen should look like this:
Now that we have gone through the general settings page, we will dive into each individual settings to give you a look for more options.
Page Cache Settings
Now that you have enabled page cache, we will show you what other options that you can tweak.
Notice in the screen above that you will see Page Cache is currently enabled. If you do not see this, then you are doing something wrong. Go back to general settings and enable it. Next, you also see the “empty cache” button. It is used to rebuild the page cache when you notice an error on your site.
The following options should be selected:-
- Don’t cache pages for logged in users (Reason: We want to see any changes that we make on the live site before it goes live.)
- Cache home page (Reason: Homepage is often the most visited page on many sites.)
- Cache feeds: site, categories, tags, comments (Reason: Your visitors may go through your categories regularly. Dynamically loading each page will slow your site down significantly.)
Note: You can also select both cache URIs with query string variables and 404 pages if you see a need for it.
Now we will look into some advanced options for Page Caching.
Under advanced options, you can select to change the page cache to be longer or smaller interval. Default is 3600 seconds. You can make it smaller interval if you have a busy site. Next option is for Rejected User Agents and Rejected Cookies. You can select not to send cache pages to Google Bot, not recommend, but you can if you wish. If your page uses a specific cookie, you should have those pages listed under rejected cookies page. All the other settings can be left to default.
Minify Settings advanced option will vary from site to site. Each option is self-explanatory, you can make changes on them if you know what you are doing.
Database Cache Settings
In the Database Cache settings, everything can be left as default. You do not need to modify it unless you know that your site needs additional modification. The most important section is the never cache the following pages. For example, if one of your page or section heavily relies on database queries, then it is wise to add that page or that entire section in this field.
Object Cache Settings
Everything should be left as default for an average site. If you know that you need something in there specifically, then you may modify it.
Browser Cache Settings
By default, only “W3 Total Cache header” and “HTTP (gzip) compression” are enabled. All the other settings can be left to default.