How to Manage Cache Exclusions and Bypass Rules?

Updated on 8. 12. 2025

Understanding Cache Exclusions

Cache exclusions are essential for maintaining website functionality while maximizing performance. They ensure that dynamic, personalized, or sensitive content is never served from cache, while allowing static content to benefit from caching acceleration.

URL-Based Cache Exclusions

 🚫 Cache Bypass Rules

URL Bypass Patterns (cache_bypass_urls)

Complete bypass URL parametr’s:
?nocache=1
?bypass_optimization=1
?zizi_bypass=1

These URL patterns will completely bypass page caching:

“`
/wp-admin/
/wp-login.php
/wp-cron.php
/xmlrpc.php
/checkout/
/cart/
/my-account/
/?preview=
/?customize_changeset_uuid=
/?elementor-preview=
/?et_fb=
/?tve=
/?brizy-edit
/?ct_builder=
/?fl_builder
/?vc_editable=
/amp/
/?s=
/search/
/wp-json/
/api/
/feed/
/comments/feed/
/sitemap
“`

### Cookie Bypass Patterns (cache_bypass_cookies)

Pages won’t be cached when these cookies are present:

“`
wordpress_logged_in_
wp-settings-
wordpress_sec_
comment_author_
woocommerce_cart_hash
woocommerce_items_in_cart
wp_woocommerce_session_
wordpress_test_cookie
wp-postpass_
edd_items_in_cart
edd_purchase_
memberpress_
s2member_
wpml_browser_redirect_test
pll_language
trp_language
“`

 🔍 Query Parameter Handling

### Ignore Query Parameters (Complete List)

These parameters are automatically stripped from URLs to prevent cache fragmentation:

#### Analytics & Tracking Parameters
“`
# Google Analytics & Ads
utm_source
utm_medium
utm_campaign
utm_content
utm_term
utm_id
utm_source_platform
utm_creative_format
utm_marketing_tactic
gclid
dclid
gbraid
wbraid
msclkid
_ga
_gl
_gac
_gat
_gid

# Facebook Tracking
fbclid
fb_action_ids
fb_action_types
fb_ref
fb_source

# Other Analytics Platforms
_hsenc
_hsmi
hs_preview
mc_cid
mc_eid
vero_conv
vero_id
pk_campaign
pk_cid
pk_content
pk_keyword
pk_medium
pk_source
mtm_campaign
mtm_cid
mtm_content
mtm_group
mtm_keyword
mtm_medium
mtm_placement
“`

#### Social Media Parameters
“`
# Twitter
ttclid
twclid
twitter_impression_id
twsrc
twttr

# Instagram
igshid

# LinkedIn
li_fat_id
linkedin_share
li_medium
li_source

# Pinterest
pin_it_button
epik

# YouTube
youtube_share
yt_share

# Generic Social
share
ref
“`

#### Czech-specific Parameters
“`
# Seznam.cz
skag
skcid
skaid
skwid
seznam_retargeting
seznam_conversion

# Czech E-commerce
heureka_overeno
zbozi_overeno
“`

#### Email Marketing Parameters
“`
mc_cid
mc_eid
vero_conv
vero_id
ck_subscriber_id
inf_contact_key
_hsenc
_hsmi
hs_preview
“`

#### Affiliate & Tracking Parameters
“`
aff_id
aff_sub
aff_sub2
clickid
subid
source_id
partner_id
cjevent
irclickid
at_medium
at_campaign
icid
cid
sid
tid
vid
“`

#### Mobile & Deep Linking Parameters
“`
deep_link_value
install_referrer
af_click_lookback
af_reengagement_window
adjust_tracker
adjust_campaign
branch_match_id
$deeplink_path
“`

#### Debug & Development Parameters
“`
age-verified
ao_noptimize
cache_bust
cn-reloaded
dm_i
ef_id
kboard_id
pp
redirect_log_mongo_id
redirect_mongo_id
sb_referer_host
s_kwcid
srsltid
sscid
trk_contact
trk_msg
trk_module
trk_sid
zizi_preload
debug
test
preview
“`

### Include Query Parameters (Create Cache Variations)

These parameters will create separate cache files for different values:

“`
lang
currency
orderby
order
paged
per_page
min_price
max_price
rating_filter
product_cat
product_tag
product_brand
country
“`

 🎨 CSS Optimization Exclusions

### CSS Minification Excludes

These CSS files and contexts are excluded from minification:

“`
# WordPress Admin
/wp-admin/
/customize.php
admin-bar
customize-controls

# Page Builders
/elementor/
/divi-builder/
/visual-composer/
/beaver-builder/
/fusion-builder/
/oxygen/
/bricks/
/breakdance/
/gutenberg/
/block-editor/

# Already Minified
.min.css
-min.css

# External CDN
fonts.googleapis.com
cdnjs.cloudflare.com
maxcdn.bootstrapcdn.com
“`

### Remove Unused CSS (RUCSS) Excludes

These CSS rules and selectors are preserved even if unused:

“`
# Media Queries
@media print
@media speech
@media aural

# Animations
@keyframes
@-webkit-keyframes
@-moz-keyframes
@-o-keyframes

# Pseudo Classes
:hover
:focus
:active
:visited
:before
:after
:first-child
:last-child
:nth-child

# WordPress Core
.wp-admin
.logged-in
.admin-bar
.customize-support

# Page Builders
.elementor
.et_pb
.fusion
[class*=”wpb_”]
[class*=”vc_”]
.fl-builder
.oxygen

# Common Plugins
.tribe-events
.woocommerce
.contact-form-7
.wpforms
.gravity
“`

 📜 JavaScript Optimization Exclusions

### JavaScript Minification Excludes

These JavaScript files are excluded from minification:

“`
# WordPress Core
/wp-includes/js/jquery/
/wp-admin/
/customize.php
wp-embed.js

# Already Minified
.min.js
-min.js

# Page Builders
elementor-frontend
divi-custom-script
fusion-scripts
beaver-builder

# External Libraries
cdnjs.cloudflare.com
ajax.googleapis.com
“`

### JavaScript Defer Excludes

These scripts are not deferred to maintain functionality:

“`
jquery.js
jquery.min.js
wp-embed.js
customize-preview
admin-bar
elementor-frontend-modules
document.write
innerHTML
“`

### JavaScript Delay Excludes (User Interaction)

These scripts are never delayed, even with user interaction delay enabled:

“`
# WordPress Core
jquery
wp-includes
wp-admin
wp-content/themes
wp-content/plugins
core.min.js

# Performance Plugins
quicklink
speculation
zizi-cache
wp-rocket
w3tc
wp-optimize
litespeed
autoptimize

# Page Builders
elementor
divi-builder
beaver-builder
vc_
fusion-
avada

# E-commerce
woocommerce

# Forms
contact-form-7
wpforms
gravity
ninja-forms

# Security
recaptcha/api.js
hcaptcha.com
cmplz_
“`

 🖼️ Image Optimization Exclusions

### Lazy Loading Excludes

These images are excluded from lazy loading:

“`
# Already Lazy
data-src
data-lazy-src
loading=”eager”

# CSS Classes
.no-lazy
.skip-lazy
.wp-post-image
[class*=”logo”]
[id*=”logo”]

# Critical Areas
.header img
.navbar img
.hero img
.banner img
.slider img

# Attributes
fetchpriority=”high”
importance=”high”
“`

### Above-the-fold Image Excludes

These images are automatically excluded from lazy loading (first 2 by default):

“`
# Position-based
First 2 images in content
Images in header section
Images in navigation
Hero/banner images

# Attribute-based
loading=”eager”
fetchpriority=”high”
Images with critical CSS
“`

 🎨 Font Optimization Exclusions

### Font Display Swap Excludes

These fonts are excluded from font-display: swap modification:

“`
# Admin Areas
/wp-admin/
/customize.php

# Already Optimized
font-display: swap
font-display: block
font-display: fallback

# Data URLs
data:font
data:application/font

# External Sources (if disabled)
fonts.googleapis.com
fonts.gstatic.com
“`

### Google Fonts Self-hosting Excludes

These fonts are not self-hosted:

“`
# Already Self-hosted
Local font files
Data URL fonts

# Specific Requirements
display=block fonts
Variable fonts (wght@)
Icon fonts
Subset fonts with specific requirements
“`

 🗄️ Database Optimization Exclusions

### Safe Database Cleanup Excludes

These database entries are protected from cleanup:

“`
# Content
Posts with post_status = ‘publish’
Recent revisions (configurable, default: last 5)
Active pages and posts

# Users & Sessions
Active user sessions
User metadata
User roles and capabilities

# Plugins & Themes
Active plugin data
Theme customization data
Widget data
Menu data

# E-commerce
Payment transaction data
Order data
Customer data
Product data

# Critical WordPress Data
Options table critical entries
Site configuration
Permalink structure
“`

⚙️ Server & Security Exclusions

### Request Method Excludes

Only these request methods are cached:

“`
✅ GET
✅ HEAD

❌ POST
❌ PUT
❌ DELETE
❌ PATCH
❌ OPTIONS
“`

### Content-Type Excludes

These content types are never cached:

“`
application/json
application/xml
text/xml
image/*
video/*
audio/*
application/pdf
text/plain (API responses)
“`

### Security Headers Bypass

Requests with these headers bypass cache:

“`
X-Requested-With: XMLHttpRequest
Content-Type: application/json
Authorization: Bearer *
X-WP-Nonce: *
“`

### Admin Context Excludes

Cache is bypassed in these contexts:

“`
is_admin() = true
is_customize_preview() = true
is_preview() = true
current_user_can(‘edit_posts’)
WP_CLI context
“`

🔌 Plugin Compatibility Exclusions

### Known Conflicting Plugins

Cache features are disabled/modified when these plugins are detected:

“`
# Other Cache Plugins
/wp-rocket/
/w3-total-cache/
/wp-super-cache/
/litespeed-cache/
/wp-optimize/
/autoptimize/
/perfmatters/
/flying-press/

# Security Plugins
wordfence
sucuri
ithemes-security

# Backup Plugins
updraftplus
backwpup
duplicator
“`

📝 Custom Exclusions Configuration

### Via wp-config.php

“`php
// Custom URL excludes
define(‘ZIZI_CACHE_CUSTOM_BYPASS_URLS’, ‘/custom-page/,/api/’);

// Custom cookie excludes
define(‘ZIZI_CACHE_CUSTOM_BYPASS_COOKIES’, ‘custom_session,user_pref’);

// Custom query parameter excludes
define(‘ZIZI_CACHE_CUSTOM_IGNORE_QUERIES’, ‘custom_param,debug_mode’);
“`

Via WordPress Filters

“`php
// CSS minification excludes
add_filter(‘zizi_cache_exclude_from_minify:css’, function($excludes) {
$excludes[] = ‘custom-style.css’;
return $excludes;
});

// JavaScript minification excludes
add_filter(‘zizi_cache_exclude_from_minify:js’, function($excludes) {
$excludes[] = ‘custom-script.js’;
return $excludes;
});

// User role excludes
add_filter(‘zizi_cache_cache_excluded_roles’, function($roles) {
$roles[] = ‘custom_role’;
return $roles;
});

// Cache file name modification
add_filter(‘zizi_cache_cache_file_name’, function($filename) {
// Custom cache file naming logic
return $filename;
});
“`

🚀 Best Practices for Exclusions

### When to Add Custom Exclusions

1. **Dynamic Content**: Pages that change frequently or show user-specific data
2. **Interactive Features**: AJAX-powered content, real-time data
3. **E-commerce**: Cart, checkout, user accounts, payment pages
4. **Forms**: Contact forms, login forms, sensitive data forms
5. **Admin Areas**: Custom admin interfaces, dashboards

### Common Exclusion Patterns

“`
# E-commerce
/checkout/*
/cart/*
/my-account/*
/?add-to-cart=*
/?wc-ajax=*

# Membership Sites
/members/*
/profile/*
/dashboard/*
/?action=login
/?action=register

# Custom APIs
/api/*
/webhook/*
/callback/*
“`

### Testing Exclusions

1. Test with and without exclusions enabled
2. Monitor cache hit rates
3. Verify functionality of excluded pages
4. Check for performance impact
5. Review log files for issues

**Note**: This list is based on ZiziCache version 0.3.7-alpha.2. Some exclusions may be configurable or may change in future versions. Always test exclusions in a staging environment before applying to production sites.


User Role-Based Exclusions

Role-Based Cache Control

Configure caching behavior based on user roles:

Administrative Roles

  • Administrator: Never cached (default)
  • Editor: Configurable caching
  • Author: Conditional caching
  • Contributor: Standard caching

Custom Roles

  • Premium Members: Separate cache for personalized content
  • Subscribers: Standard caching with user-specific elements
  • Customers: E-commerce specific caching rules

Implementation Strategy

Role-based exclusions work through:

  1. User role detection via WordPress authentication
  2. Cookie-based role identification for performance
  3. Separate cache file generation per role combination
  4. Automatic role-based cache invalidation

Advanced Bypass Scenarios

Conditional Cache Bypass

Dynamic bypass rules based on specific conditions:

Time-Based Exclusions

  • Exclude during maintenance windows
  • Bypass cache during peak traffic times
  • Temporary exclusions for special events

Content-Based Exclusions

  • Password-protected content
  • User-specific personalized pages
  • Real-time data displays
  • Interactive elements requiring fresh data

Programmatic Exclusions

Use WordPress hooks for dynamic exclusion control:

// Exclude specific post types
add_filter('zizi_cache_exclude_post_type', function($excluded_types) {
    $excluded_types[] = 'private_content';
    return $excluded_types;
});
// Custom bypass logic
add_filter('zizi_cache_bypass_cache', function($bypass, $request) {
    if (custom_condition_check()) {
        return true;
    }
    return $bypass;
}, 10, 2);

Mobile and Device-Specific Exclusions

Device Type Detection

Configure exclusions based on device characteristics:

  • Mobile devices: Separate cache or exclusions
  • Tablet devices: Custom caching rules
  • Desktop browsers: Standard caching behavior
  • Bot traffic: Specific handling for crawlers

User Agent Exclusions

Exclude specific user agents from caching:

Googlebot
Bingbot
facebookexternalhit
Twitterbot
LinkedInBot

Testing Cache Exclusions

Verification Methods

Confirm exclusions are working correctly:

  1. Browser Developer Tools: Check response headers
  2. Cache Status Headers: Look for BYPASS status
  3. File System Check: Verify cache files are not created
  4. Performance Testing: Compare response times

Debug Cache Decisions

Enable debug logging to understand cache behavior:

  • Check ZiziCache debug logs for exclusion reasons
  • Monitor cache hit/miss ratios
  • Review bypass cookie detection
  • Analyze URL pattern matching results

Common Exclusion Patterns

WordPress Core Exclusions

/wp-admin/
/wp-login.php
/wp-cron.php
/xmlrpc.php
/wp-json/
/wp-content/
/wp-includes/

Plugin-Specific Exclusions

/wp-content/plugins/
/?wc-ajax=
/?add-to-cart=
/?remove_item=
/?wc-api=
/edd-api/
/?edd-listener=

Security and Maintenance

/sitemap
/.well-known/
/robots.txt
/ads.txt
/security.txt

Best Practices for Cache Exclusions

Performance Optimization

  • Minimize exclusions: Only exclude truly dynamic content
  • Use specific patterns: Avoid overly broad exclusion rules
  • Regular review: Periodically audit exclusion rules
  • Monitor impact: Track cache hit rates after changes

Security Considerations

  • Always exclude admin and authentication pages
  • Protect sensitive user data from caching
  • Exclude payment and transaction pages
  • Consider privacy implications of cached content

Maintenance Guidelines

  • Document all custom exclusion rules
  • Test exclusions after WordPress updates
  • Review plugin compatibility regularly
  • Monitor for new exclusion requirements

Proper cache exclusion configuration ensures optimal performance while maintaining website functionality and security. Regular monitoring and testing help maintain the balance between cache effectiveness and dynamic content requirements.

What are your feelings