Caching makes your website faster by saving ready-made versions of pages. It’s great for speed, but it can cause problems when pages need to be updated in real time.
Dynamic pages—like login screens, shopping carts, and user dashboards—depend on fresh data for each visitor.
When these pages are cached, they may show the wrong information, stop updating, or break completely.
If your cart isn’t updating, users see incorrect details, or login actions fail, caching is likely the issue.
In this guide, you’ll learn exactly how to fix it. Step by step, you’ll identify the problem, exclude the right pages, and configure your cache so everything works as it should.
If you want to understand how it all works, read our complete guide to WordPress caching for a full breakdown.
What Are Dynamic Pages?
Dynamic pages are pages that change based on the user, their actions, or real-time data. Each visitor may see different content on the same page.
Static pages, on the other hand, show the same content to every user. These pages don’t change unless you manually update them, which makes them safe to cache.
Examples of Dynamic Pages
- WooCommerce cart and checkout pages
- User dashboards and account pages
- Membership or subscription-only content
- Login and registration pages
Why These Pages Should Not Be Cached
Dynamic pages rely on real-time data. Caching them can show outdated or incorrect information to users.
For example, a cached cart may not update when items are added or removed.
A cached dashboard may show another user’s data. Login pages may fail to work properly.
To avoid these issues, dynamic pages should always be excluded from caching.
Why Caching Breaks Dynamic Pages
Caching works by saving a ready-made version of a page and serving it to every visitor. This reduces load time because the page doesn’t need to be rebuilt each time.
The problem is that cached pages don’t adapt to individual users.
Dynamic content needs to change based on actions, sessions, or user data, but caching delivers the same version to everyone.
Common Symptoms of This Issue
- Cart not updating after adding or removing items
- Users seeing incorrect or outdated data
- Login or logout is not working properly
- Forms not submitting or refreshing correctly
These issues happen because the page is no longer updating in real time. Instead, users are seeing a stored version that doesn’t reflect their actions.
Identify If Caching Is the Problem
Before making changes, confirm that caching is actually causing the issue. A few quick checks can help you identify the root problem.
Quick Tests
- Check in incognito mode: Open your site in a private window. If the issue disappears, caching is likely involved.
- Compare logged-in vs logged-out views: If the problem only happens when logged in (or logged out), cache rules may be misconfigured.
- Clear cache and retest: Clear your website cache, browser cache, and reload the page. If it works temporarily, caching is the cause.
Tools to Diagnose Caching Issues
- Use your caching plugin’s debug or test mode
- Check browser developer tools (Network tab) for cached responses
- Temporarily disable your caching plugin to confirm the issue
These steps help you quickly confirm whether caching is breaking your dynamic pages before applying a fix.
Exclude Dynamic Pages From Cache
Excluding dynamic pages from cache is the most important fix. These pages rely on real-time data, and caching them can break core functionality like carts, logins, and user accounts.
For example, eCommerce pages such as cart, checkout, and account pages must always stay dynamic. If cached, users may see incorrect items or sensitive data.
How to Exclude Pages From Cache
1. Exclude by URL
This is the most common method. You simply tell your caching plugin not to cache specific page URLs.
Examples:
/cart//checkout//my-account/
Most caching plugins provide a “Never Cache URLs” or similar setting where you can add these paths.
2. Exclude by Cookies
Dynamic content often depends on cookies (like user sessions or cart data). When these cookies are detected, caching should be bypassed.
For example, WooCommerce uses cookies to track cart contents and user sessions. If these cookies are present, the page must not be cached.
Common examples:
woocommerce_items_in_cartwoocommerce_cart_hash- User session cookies
Caching plugins allow you to define “Never Cache Cookies” so pages update correctly when these cookies are set.
Examples for Popular Caching Plugins
WP Rocket
- Go to Settings → WP Rocket → Advanced Rules
- Add URLs under “Never Cache URL(s)”
- Add cookies under “Never Cache Cookies”
- WooCommerce pages (cart, checkout, account) are often excluded automatically
W3 Total Cache
- Go to Performance → Page Cache → Advanced
- Add URLs to “Never cache the following pages”
- Add cookies to “Rejected cookies”
- Save settings and clear cache
LiteSpeed Cache
- Go to LiteSpeed Cache → Cache → Excludes
- Add URLs under “Do Not Cache URIs”
- Add cookies under “Do Not Cache Cookies”
- Save changes and purge cache
Use Cache Rules for Logged-In Users
Logged-in users should not be served cached pages. Their experience is personalized, and caching can show outdated or incorrect data.
For example, admins need to see real-time changes when editing the site.
Members and subscribers need accurate account details, orders, or content access. Caching can break all of this.
Why Logged-In Users Should Bypass Cache
- Content is user-specific and changes frequently
- Cached pages may show outdated or incorrect data
- Can cause login, logout, or session issues
- May expose private or sensitive information
How to Disable Caching for Logged-In Users
Admin Users
- Always exclude administrators from cache
- Ensures you see live changes while managing the site
- Prevents confusion when editing pages or settings
Members / Subscribers
- Disable caching for logged-in users with accounts
- Important for membership sites, courses, and WooCommerce
- Ensures accurate dashboards, orders, and account data
Plugin Settings to Configure
- Enable “Don’t cache logged-in users” (common option in most plugins)
- Use user role-based exclusions (if available)
- Add session cookies to cache exclusion rules
- Clear the cache after applying changes
Enable WooCommerce / Dynamic Page Compatibility
WooCommerce relies heavily on dynamic content. To keep your store working properly, your caching setup must support these dynamic features.
Built-In Exclusions in WooCommerce
WooCommerce automatically excludes key pages from caching in most setups.
These typically include:
- Cart page
- Checkout page
- My Account page
These pages are designed to stay dynamic, so they update in real time for each user.
Ensure Key Features Work Correctly
Cart Fragments Update Properly
- WooCommerce uses cart fragments to update the cart without reloading the page
- If caching interferes, the cart may not refresh or show the wrong items
- Make sure cart fragments are not delayed, combined, or cached
AJAX Requests Are Not Cached
- WooCommerce uses AJAX for actions like adding items to the cart
- Cached AJAX responses can break functionality
- Ensure your cache plugin excludes AJAX requests from caching
Plugin Compatibility Settings
Most caching plugins include WooCommerce-specific options. Make sure these are enabled:
- Enable WooCommerce compatibility mode (if available)
- Exclude WooCommerce cookies automatically
- Disable JavaScript delays for cart-related scripts
- Keep critical WooCommerce scripts out of minification or deferral
Key Takeaway
WooCommerce needs real-time updates to function correctly.
Ensure built-in exclusions are active, and configure your cache so cart updates and AJAX requests always work without interference.
Fix Issues With AJAX and JavaScript
Dynamic pages rely on JavaScript and AJAX to update content without reloading the page. If caching or optimization settings interfere, key features can stop working.
Role of AJAX in Dynamic Content
AJAX allows parts of a page to update in real time.
Common uses:
- Updating cart totals
- Submitting forms without a refresh
- Loading user-specific data
If AJAX is cached or blocked, these actions may fail or show outdated results.
Problems Caused by Optimization Settings
Minification
- Combines and compresses JavaScript files
- Can break scripts if dependencies load in the wrong order
- May cause features like carts or forms to stop working
Delayed JavaScript
- Delays script loading to improve speed scores
- Can prevent important scripts from running on time
- Results in buttons, carts, or login actions not responding
How to Exclude Important Scripts
To fix these issues, exclude critical scripts from optimization:
- Identify scripts related to:
- WooCommerce (cart, checkout)
- Login and user sessions
- Forms and interactive elements
- Add them to:
- Exclude from minification
- Exclude from delay/defer settings
- Common examples to exclude:
wc-cart-fragmentswoocommerce.jsjquery.js(in some cases)
- Test after each change to confirm functionality
Clear All Layers of Cache
After making changes, you must clear every layer of cache. If you skip this step, old cached versions can still appear and make it seem like nothing worked.
Types of Cache to Clear
Plugin Cache
- Clear the cache from your WordPress caching plugin
- This removes stored versions of your pages
Browser Cache
- Your browser may store old files locally
- Clear it or test in an incognito window
CDN Cache (e.g., Cloudflare)
- CDNs store cached content across global servers
- Purge the cache from your CDN dashboard
Server Cache
- Some hosting providers use server-level caching
- Clear it from your hosting control panel or ask support
Why Changes May Not Reflect Immediately
- Multiple cache layers can serve old content
- CDN and server caches may take time to update
- The browser cache may still load outdated files
If one layer isn’t cleared, your site may still show the old version.
Advanced Fixes
If basic exclusions don’t fully solve the problem, you may need more advanced methods.
These give you better control over how caching behaves, especially on complex or high-traffic sites.
Use Edge Side Includes (ESI) for Dynamic Elements
ESI allows you to cache most of a page while keeping specific parts dynamic.
Instead of disabling cache for the entire page, you can exclude only small sections. For example, you can cache the page layout but keep the cart total or user greeting dynamic.
This improves performance without breaking functionality.
To use ESI:
- Enable ESI in your caching plugin (if supported, like LiteSpeed)
- Define which parts of the page should remain dynamic
- Test carefully to ensure the dynamic sections update correctly
This is useful for stores or membership sites where only certain elements change per user.
Implement Server-Side Rules (NGINX/Apache)
Server-level rules give you deeper control than plugins. They allow you to define exactly what should and should not be cached before WordPress even loads.
For example, you can:
- Exclude specific URLs like
/cart/or/checkout/ - Bypass cache when certain cookies are detected
- Prevent caching for logged-in users
Basic examples:
NGINX:
- Bypass cache if cookies like
wordpress_logged_inare present - Exclude WooCommerce pages using URL rules
Apache (.htaccess):
- Set rules to skip cache for dynamic pages
- Control caching behavior using conditions
These rules are powerful, but they must be applied carefully. A small mistake can affect your entire site. If unsure, check with your hosting provider.
Use Object Caching Properly (Redis/Memcached)
Object caching stores database query results instead of full pages. This means your site can stay dynamic while still being faster.
Unlike page caching, object caching does not serve the same HTML to every user. It speeds up how data is fetched behind the scenes.
Common tools:
- Redis
- Memcached
To use it properly:
- Enable object caching through your host or a plugin
- Avoid mixing it incorrectly with aggressive page caching
- Test dynamic pages to ensure data updates correctly
This is ideal for WooCommerce and membership sites where data changes frequently.
When to Disable Cache Entirely for Specific Pages
In some cases, the best solution is to completely disable caching for certain pages.
Do this when:
- Pages rely heavily on real-time user interaction
- AJAX and scripts still break after exclusions
- Sensitive or user-specific data is displayed
Examples:
- Checkout pages
- User dashboards
- Custom application-like pages
To disable caching:
- Add the page URL to your cache exclusion list
- Use server rules to force no-cache
- Confirm with testing that the page updates in real time
Best Practices to Avoid Future Issues
- Always exclude dynamic pages from the start
Prevent problems early by ensuring pages like cart, checkout, and account are never cached. - Test after enabling caching
Check key functions (cart, login, forms) immediately to catch issues before users do. - Avoid multiple caching plugins
Using more than one caching plugin can cause conflicts and break your site. - Keep plugins/themes updated
Updates often include fixes for compatibility and performance issues. - Monitor site behavior regularly
Periodically review your site to ensure everything still works as expected after changes.
Final Thoughts
Caching can improve speed, but it can also break dynamic pages if not set up correctly.
The key is to exclude the right pages, handle cookies properly, and ensure scripts and AJAX work as expected.
Start with basic fixes like page exclusions, then move to advanced settings if needed. Each step helps your site stay fast without breaking important features.
Always test after every change. This ensures your site works properly for all users while still benefiting from caching.
For a deeper explanation, check out this WordPress caching explained guide to see how everything fits together.
FAQs
Why is my cart not updating?
Your cart page is likely being cached, or key scripts (like cart fragments) are blocked.
Should I disable caching completely?
No. Only exclude dynamic pages. Keep caching enabled for static content.
Can I cache logged-in users safely?
In most cases, no. Logged-in users should bypass the cache to avoid incorrect data.
What is the best caching plugin for dynamic sites?
There’s no single best option. Choose one that supports page exclusions, cookie rules, and WooCommerce compatibility.
Why do users see outdated data?
Cached pages are serving old content instead of real-time updates, often due to missing exclusions.