Why Excluding Specific Pages and Directories?
There are many reasons for excluding specific pages and directories from caching for proper loading. In our cache we have the following situations:
- Work with WooCommerce – the product and cart pages generally breaks with W3TC caching
- Theme showcasing – the sliders will break with the caching and not load properly on mobile devices
- Visual Composer – the blog carousel will not work properly with W3TC
How to Exclude Pages and Directories from Caching in W3 Total Cache?
Login to your WordPress admin panel and navigate to “Performance > Page Cache” section. Scroll down to the “Advanced” section and look for the option “Never cache the following pages”.
Enter the page URLs and directories under the “Never cache the following pages” to exclude them from caching.
How to Enter Page URL and Directories?
The exception supports regular expression. Enter one entires per line, it could be a page URL or the directory. The URLs and the directories are entered as relative URLs to your domain. Below are some of the examples:
Other Possibilities for Excluding Content from Caching
Besides excluding posts, pages and directories there are many other possibilities allowed in W3TC. These options are available in the same “Advanced” section under “Page Caching”.
Excluding Posts with Specified Categories
You can exclude all the posts under specified category by mentioning the category slug in the text box “Never cache pages associated with these categories”. For example, if you have the category named “technology” then just enter the slug as “technology” without leading or trailing slash.
Excluding Posts with Specified Tags
Similar to categories, you can ignore the posts from caching based on the tags. Remember to enter the tag slug without slashes.
Excluding Posts Based on Author
Enter the author names one per line in the box “Never cache pages” to exclude them from caching based on the author.
Exclude Posts Based on Custom Fields
Also you can exclude the pages from caching based on the usage of custom fields on the pages. The format of the entry should be like “custom filed=value” as shown below.