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.
The blog carousel element that comes with most page builder plugins like WPBakery doesn’t work properly in W3TC.
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.
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.