Back to Community

Understanding and Configuring Cookie Exclusions in WP Fastest Cache

19 threads Sep 16, 2025 PluginWp fastest cache

Content

Caching plugins are essential for a fast website, but they can sometimes cause issues with dynamic content that relies on user-specific data stored in cookies. A common challenge is ensuring that pages are not served from the cache when a user has a specific cookie, such as those for logged-in users, shopping carts, or GDPR consent. This guide explains how WP Fastest Cache handles cookie-based exclusions and how to configure them effectively.

Why Cookie Exclusions Matter

By default, WP Fastest Cache serves the same cached HTML file to all visitors. This is a problem if your site's content changes based on a cookie. For example, a WooCommerce site should not show a cached "empty cart" page to a user who has added items to their cart. Similarly, a GDPR banner might not function correctly if the page is cached before a user has given consent. Configuring cookie exclusions tells the plugin to bypass the cache and generate a fresh page when it detects specific cookies, ensuring each user gets the correct, personalized content.

How Cookie Exclusion Works

When you exclude a cookie in WP Fastest Cache's settings, the plugin's behavior is specific and targeted. It does not delete the cached page for all users. Instead, it performs a check on each page request:

  1. The plugin checks if the visiting browser has a cookie that matches your exclusion rule.
  2. If the cookie is found, the plugin will not serve the cached page. It will bypass the cache and load a fresh, uncached version of the page from WordPress.
  3. If the cookie is not found, the plugin will serve the cached page normally, ensuring fast load times for most visitors.

This means you can have a single cached version of a page for anonymous users while dynamically generating pages for users with specific cookies.

Common Cookies to Exclude

Based on community experience, here are some common cookies you may need to exclude to ensure proper site functionality:

  • WordPress Login Cookies: The plugin excludes cookies for administrators by default to prevent them from seeing cached pages.
  • WooCommerce Cookies: Cookies like woocommerce_items_in_cart or woocommerce_cart_hash are crucial to exclude so that cart and checkout pages update correctly.
  • GDPR/Consent Cookies: Cookies set by plugins like Ultimate GDPR & CCPA or Cookie Notice should be excluded to ensure the cookie banner and subsequent page reloads work as intended.
  • Custom Session Cookies: If your site or a plugin uses a cookie to change content (e.g., a country code), you will need to exclude it.

How to Configure Cookie Exclusions

  1. In your WordPress dashboard, go to WP Fastest Cache > Settings.
  2. Click on the Exclude tab.
  3. Find the section labeled Cookies.
  4. In the input field, enter the name of the cookie you wish to exclude (e.g., woocommerce_items_in_cart).
  5. Click Add New Rule and then Submit to save your changes.
  6. Always clear your site's cache after adding new exclusion rules for them to take effect immediately.

Important Note: You must enter the exact name of the cookie. Using wildcards like * is not necessary or supported in this field. There is currently no feature to exclude all cookies at once; each one must be added individually.

Troubleshooting Cookie Exclusion Issues

If your exclusions don't seem to be working, try these steps:

  • Clear Cache: Rules are applied when a new cache is created. Always clear all cache after changing settings.
  • Check for Conflicts: Other caching layers, such as host-level caching (e.g., HostGator) or a CDN (e.g., Cloudflare), might be serving cached pages and ignoring WP Fastest Cache's rules. You may need to configure exclusions there as well or temporarily disable them to test.
  • Verify the Cookie Name: Use your browser's developer tools (Application/Storage tab) to check the exact name of the cookie being set on your site.
  • Plugin-Specific Hooks: Some plugins, particularly those that pull external data like Instagram feeds, may not be fully compatible with caching. The WP Fastest Cache team provides hooks for developers to programmatically clear the cache when specific events occur.

Conclusion

Properly configuring cookie exclusions is key to balancing site speed with dynamic functionality. By understanding how the feature works and applying the correct rules for your site's cookies, you can prevent most caching-related issues for logged-in users, shopping sessions, and consent management. Remember that exclusion rules are stored in your database and do not create lines in your .htaccess file. If problems persist, investigate other server-level caching solutions that might be interfering with your WordPress plugin's settings.

Related Support Threads Support