If you are looking for a checklist and best practices to set up W3 Total Cache Plugin for WordPress sites, check out our guide below.
Related: How to Setup Cloudflare Cache for WordPress
W3 Total Cache has over a million active installations and is one of the recommended plugins to have. It offers complete control over various optimizations at a granular level, unlike most cache plugins. It helps advanced users and developers to make various optimization combinations to get the desired results.
W3 Total Cache is the greatest comprehensive plugin that does exactly what it says- Improves the performance of a site using multiple-stage caching.
Popular websites that use W3TC are:
Why W3TC is a best Caching plugin?
The implementation of flexibility, cutting-edge feature, and broad range of support makes it the best plugin.
- Cutting-edge features and flexibility are amazing—5/5 for performance.
- Found compatible with Cloudflare, Varnish, and more.
- Lots of settings may confuse beginners, but the same make the plugin extremely flexible.
Before proceeding with following steps, make sure to disable every other caching plugin. Moreover, it is recommended to prevent the use of numerous caching plugins at WordPress.
Installation & Setup process:
- First of all, login to WordPress Dashboard example.com/wp-admin/
- Now follow the below path: Plugins > Add new > Search for W3 Total Cache
- Now install and Activate
- Go to Settings > General
- Click on Hide button to discard following header message.
- Preview mode: Don’t touch
- Enable Page Cache > Choose Page Cache Method > Disk Basic
- Minify: Don’t touch.
- OpCode Cache: Don’t touch
- Database Cache: Disk
- Object Cache: Don’t touch
- Browser Cache: Enable
- CDN: Choose Generic Mirror (Addition of cdn.exmaple.com in the forthcoming steps)
- Reverse Proxy: This should be enabled if you use Varnish. (Additionally, make sure to enter application path wordpress-xyz-abc.cloudwaysapps.com:8080 in case you are a Cloudways user. Your App path is mentioned at Applications > Domain management.)
- In the Miscellaneous tab, you need to uncheck Enable Google Page Speed dashboard widget.
- Save Settings and Purge Caches. At this step, the general Settings completes.
- Now open the Page Cache menu of the W3 Total Cache plugin.
- Check “Cache front page.”
- Check “Cache feeds: site, categories, tags, comments.”
- Check “Cache SSL (https) requests”
- Don’t change “Cache URIs with query string variables.”
- Don’t change “Cache 404 (not found) pages.”
- Check “Don’t cache pages for logged in users”
- Check “Don’t cache pages for following user roles.”
Tip: You might choose user role – Administrator, Editor, and Author” for those you don’t wish to clutter with cache
- Aliases: Let it stay blank.
- Cache Preload: Keep it unchecked.
- Purge Policy: Should check Front Page, Post Page, Blog Feed
- Finally, save settings so that you never need to visit the Page Cache option of W3TC again.
- Please navigate to the Browser Cache menu and configure it correctly. (Typically, browser cache is regulated by an HTTP header names “cache-control” that guides the browser the proper way to manage e particular file. It decides whether to cache or not.)
- Firstly, you will notice the General Settings that specifies global browser cache policy. You might override depending on the file type. The same is the exceptional and flexible feature of this plugin. This feature is not found in any other well-known cache plugin.
- It is important to understand what these menus mean. First one is Last Modified, I advise enable it, assists Googlebot to do not forcefully crawl non-modified static resources.
- Set Expires header which is commonly utilized by proxy, to save file, web page in the cache memory for a specific time period. Make sure to keep it disable.
- Now you have to set the cache-control header which is utilized by browser. Now you have to keep it disable. Since keeping globally is not a decent idea.
- In this step, you have to set the entity tag (ETag) and keep that option enable. It assist browser to validate cached file either to be used or not.
- Now you need to set the W3 Total Cache header. In order to keep the thing white level you have to disable this feature. Either the header is disabled or enabled; it does not matter.
- Enable HTTP (gzip) compression: You may enable this feature.
- Avoid objects getting cached after settings change. Make sure not to enable it. Otherwise, it may add to your bandwidth consumption by avoiding appropriate browser cache. Particularly, this feature must be used only when you encounter some issue in which you are unable to override browser cache for the static files.
- Discard query strings from static resources: Please don’t enable this. When you enable this feature, it will just enhance grade by discarding query strings like ver=?2.3 outside the static files. Doing this will not enhance actual load time.
- Don’t set cookies for static files: Enable.
- Do not process 404 errors for static objects with WordPress: Famous feature from W3TC plugin that decreases server load for the 404. You may observe that how a single 404 error occasionally leads to a long time for loading. The particular option decrease the impact by serving simple 404 page instead of attractive for static files like jpg, txt, etc. It would be best if you did not worry as this is not for standard pages. It is recommended to enable this feature.
- The rewrite URL structure of objects: Let it stay uncheck.
- Apply HTTP Strict Transport Security policy: It is a great setting for caching “force HTTPS request”. If you are novice to WordPress, make sure not to enable this; it may lead to problems when you occasionally miss SSL. The browser will prevent the loading process in HTTPS or HTTP, except you keep valid certificate.
- Now, navigate down and find CSS & JS. The particular setting is applicable only for CSS and JS. Look at the screenshot below.
- For HTML, the Browser cache settings must have slight modification. It is clear that our HTML (a document in browser language) is basically a dynamic version of content. It is always better to not cache anything for HTML. Also, the same is not a recommended approach. In case you keep expire 3600seconds then it means that again W3TC will continue refreshing pages. It is better to prevent browser caching for HTML.
- For Media elements, the settings must be identical to JS and CSS. Go through the below screenshot.
- Now one important setting is CDN If you have enabled the “Generic Mirror” or CDN option in the most recent General Settings page in previous steps, you now have to configure it. (Warning: Please don’t alter any of these options otherwise you may face problem.)
- Navigate down a bit at the CDN page, and you will observe “General” settings. Go through the below screenshot.
- General: Don’t check Add canonical header: Google doesn’t support it.
- Configuration: Navigate down, and mention your CDN path
- Advanced: Navigate down and enable the Set cookie domain.
- Now CDN configuration is complete, so click on Save Settings and Purge Caches.
- Open the Extensions menu of W3TC. Make sure to disable everything apart from Yoast SEO. As a result, it will direct the correct CDN path for images within the Yoast XML Sitemap.
All these steps included the needful tasks you need to follow.