VaryCache
·
Advanced caching with A/B testing, geo-targeting, and speed optimizations. Serve different cached versions of pages.
VaryCache is a powerful WordPress caching plugin that combines page caching with content personalization. Serve different cached versions of your pages based on A/B tests, visitor location, or URL parameters — all while maintaining excellent performance.
Core Caching
- Page Cache — File-based caching for fast page delivery without database overhead
- REST API Cache — Cache REST API responses to reduce server load
- Cache Preload — Automatic cache warming from sitemap
- Browser Cache Headers — Cache-Control, Expires, Last-Modified, Vary headers
Content Personalization
- A/B Testing — Create multiple tests with weighted variants (50/50, 70/30, etc.)
- Geo Targeting — Show different content based on visitor’s country
- Query Parameters — Cache variations based on UTM tags and other URL parameters
Speed Optimizations
- HTML Minification — Remove whitespace to reduce page size
- DNS Prefetch — Pre-resolve external domains for faster loading
- Preload Resources — Preload fonts, CSS, and hero images for better LCP
- Link Prefetch — Preload pages on hover for instant navigation
- Disable Emoji — Remove WordPress emoji scripts (~15KB savings)
- Remove Query Strings — Better CDN caching for static resources
- Image Dimensions — Auto-add missing width/height to prevent CLS
- Gzip Compression — Compress HTML output to reduce page size by ~70%
Developer Features
- Shortcodes — Easy content switching in posts and pages
- PHP Functions — Helper functions for theme developers
- Debug Panel — Visual debugging panel on frontend
- CDN Compatible — Works with CloudFront, Cloudflare, and other CDNs
- Translation Ready — Includes Russian translation
Shortcodes
[varycache_ab v="A"]Content for variant A[/varycache_ab]
[varycache_ab v="B"]Content for variant B[/varycache_ab]
[varycache_ab test="pricing" v="X"]Content for specific test[/varycache_ab]
[varycache_geo country="US"]Content for US visitors[/varycache_geo]
PHP Functions
// A/B Testing
if ( varycache_is_variant( 'A' ) ) {
// Show variant A content
}
$variant = varycache_get_variant(); // Returns 'A', 'B', etc.
// Geo Targeting
if ( varycache_is_geo( 'US' ) ) {
// Show US-specific content
}
$country = varycache_get_geo(); // Returns 'US', 'RU', etc.
Page Patterns
Flexible page matching with wildcards and regex:
/— Homepage only/pricing— Exact page match/blog/*— Single level wildcard/shop/**— Any depth wildcard~^/post/\d+$— Regular expression (prefix with ~)
Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Write access to wp-content directory
