W3 Total Cache is one of the top free caching plugins for WordPress with over 1 million active installs. However, it needs to be set up correctly on your site in order to cache pages and work properly. With hundreds of settings available under different sections, it’s easy to get lost. It’s easy to make mistakes in the settings, which can affect page speed and ruin your site’s layout. Especially when you use a lot of JavaScript on your pages, you should thoroughly test W3 Total Cache (W3TC) on your staging or test site before deploying to a live site. Here’s a detailed tutorial for when you notice some pages are mislaid out and want to exclude them from the cache.

Exclude pages and directories from W3 Total Cache plugin cache

Why exclude specific pages and directories?

There are many reasons to exclude a specific page or directory from the cache for proper loading. It depends on the theme and plugins you use on your website. Here are some common cases of issues with the W3 Total Cache plugin:

When you have a WooCommerce plugin, product and cart pages often break due to W3TC caching.

Using the slideshow carousel with jQuery or JavaScript will break the cache and not load correctly, especially on mobile devices.

The blog carousel element that comes with most page builder plugins like WPBakery doesn’t work properly in W3TC.

If you use a theme that relies heavily on jQuery, you will need to disable JavaScript minification to load the page correctly. Fortunately, the W3TC provides an option to exclude pages and directories using wildcards so that you can easily exclude them from the cache.

Exclude pages and directories from W3 Total Cache plugin cache

Login to your WordPress admin panel and navigate to the “Performance > Page Cache” section. Scroll down to the “Advanced” section and look for the “Never cache the following pages” option.

Exclude pages and directories from W3 Total Cache plugin cache

How to enter page URL and table of contents?

W3 Total Cache allows multiple ways to get to pages and directories to be excluded from the cache. You can use URL, directory name, wildcard and regular expression formats. When entering your details, please make sure to follow these guidelines:

Enter one whole per line, which can be a page URL or a directory.

URLs and directories are entered to your domain as relative URLs. This means you need to ignore the site address and just enter the rest.

Other possibilities to exclude content from the cache

Besides excluding articles, pages and directories, the W3 Total Cache plugin allows for a few other possibilities. These options are available in the “Page Caching” menu under “Advanced”.

Exclude articles from specified categories

You can exclude all articles under a given category by mentioning the category label in the “Never cache pages associated with these categories” text box. For example, if you have a category called “Technology” then just fill in its slug with no leading or trailing slashes. The plugin will exclude all articles under the “Technology” category from the cache and users will view non-cached pages.

Be careful with other options

As mentioned, the problem with the W3 Total Cache plugin is that you can easily get confused with the settings. Just below “Never cache….”. options, you’ll find more options that have nothing to do with excluding pages, in fact, they’re used for inclusion in the cache.

There is another option called “Cache exception list”. The plugin will cache any URL or directory you enter in this box, whether or not you excluded it using one of the above exclusion methods. So make sure to keep this box when you’re excluding pages from the cache.

Additionally, the “Non-trailing slash pages” option is useful for caching pages that contain no trailing slashes. Typically, you can use it to cache XML sitemaps and other files that don’t have slashes in WordPress. Therefore, to exclude a page from the cache, you should not enter a URL or directory in this box.

Finally, keep the “Specify page headers” section, which is also used for cached pages, not for exclusions.

Recommended reading:

What is OG WhatsApp Pro?

How do you react when someone blocks your GB WhatsApp?

Leave a Reply

Your email address will not be published. Required fields are marked *