WordPress caching plugins improve site performance by storing static versions of your pages. When a visitor requests a page, the caching plugin serves the stored version instead of generating it fresh—dramatically reducing server load and page load times.
However, this creates a challenge for view counting: if a cached page is served without running PHP on each request, the counter cannot record new views. A visitor may load the same cached page multiple times, but no views are recorded because the server-side counting logic never executes.
Post Views Counter Pro solves this through an Optimizations Module that automatically detects supported caching plugins and applies compatibility tweaks specific to each caching solution.
How It Works
The Optimizations Module provides caching compatibility through automatic detection and targeted integration loading.
Automatic Detection
When Post Views Counter Pro initializes, the Optimizations Module scans for active caching plugins. The detection layer identifies which supported caching solution is running on your site and normalizes compatibility checks so the plugin can report integration status consistently.
Integration Loading
Once a supported caching plugin is detected, Post Views Counter Pro loads the corresponding integration file from the includes/optimizations/ directory. Each integration file contains plugin-specific compatibility tweaks that ensure the counter functions correctly with that particular caching solution.
These tweaks may include:
- Automatically excluding counter scripts from cache
- Adjusting how view data is transmitted
- Configuring cache bypass rules for specific endpoints
Supported Caching Plugins
Post Views Counter Pro includes dedicated integration files for the following caching and optimization plugins:
| Plugin | Integration File |
|---|---|
| Autoptimize | optimizations/autoptimize.php |
| Breeze | optimizations/breeze.php |
| Hummingbird | optimizations/hummingbird.php |
| LiteSpeed Cache | optimizations/litespeed-cache.php |
| Speed Optimizer | optimizations/speed-optimizer.php |
| SpeedyCache | optimizations/speedycache.php |
| WP Fastest Cache | optimizations/wp-fastest-cache.php |
| WP-Optimize | optimizations/wp-optimize.php |
| WP Rocket | optimizations/wp-rocket.php |
Setup
For detailed setup instructions, including how to enable caching compatibility and configure your counter mode for cached environments, refer to the Count Views with Caching guide.
The setup process involves:
- Enabling the Caching Compatibility option in Post Views Counter settings
- Selecting an appropriate counter mode for your caching environment
- Verifying that views are being recorded correctly
Configuration
Caching Compatibility Setting
The primary setting for caching plugin integration is located at:
Post Views > Counting > Performance & Caching > Caching Compatibility
This option enables compatibility tweaks for supported caching plugins. When enabled, Post Views Counter Pro activates the Optimizations Module and loads the appropriate integration files for any detected caching plugins.
| Property | Value |
|---|---|
| Option ID | caching_compatibility |
| Type | Boolean |
| Default | false |
| Availability | Pro-only |
Enable this option when using any supported caching plugin to ensure accurate view counting.
Counter Mode Considerations
While caching compatibility can help with PHP Mode in certain scenarios, cached environments typically require client-side counting methods. JavaScript Mode, REST API Mode, and Fast AJAX execute in the visitor’s browser after the cached page loads, bypassing the caching layer for view recording.
For guidance on selecting the appropriate counter mode for your specific caching setup, refer to Choose the Best Counter Mode.
Troubleshooting
Views Not Updating
If view counts appear stuck or not updating on a cached site:
- Verify Caching Compatibility is enabled — Check that the option at Post Views > Counting > Performance & Caching is turned on
- Confirm your caching plugin is supported — Only the plugins listed in the supported plugins table have dedicated integration files
- Check your counter mode — PHP Mode may not work with aggressive caching; consider JavaScript Mode, REST API Mode, or Fast AJAX
- Clear your cache — Some caching plugins may serve stale pages; clear the cache and test again
Counts Stuck at Zero
If views are not being recorded at all:
- Check for JavaScript errors — Open browser developer tools and look for console errors that might prevent the counter script from executing
- Verify REST API accessibility — If using REST API Mode, ensure the REST API endpoints are not blocked by security plugins or server configuration
- Test with caching disabled — Temporarily disable your caching plugin to confirm the counter works without caching
Unsupported Caching Plugins
If you are using a caching plugin not listed in the supported plugins table, the Optimizations Module will not load a dedicated integration file. In this case:
- Use JavaScript Mode, REST API Mode, or Fast AJAX for reliable counting
- Contact support to request integration for your specific caching plugin
- Check if your caching plugin offers exclusion rules for specific scripts or REST API endpoints
