How to Resolve WP Rocket Caching Issues With Captain Compliance

Edited

WP Rocket is a popular WordPress caching and performance plugin. On sites that use it together with Captain Compliance, the consent banner can render correctly but fail to respond to clicks.

Summary of the issue

WP Rocket’s Delay JavaScript Execution feature can interfere with the Captain Compliance consent banner script. When this happens, the banner appears, but its buttons (for example Allow, Reject, or Cookie Settings) seem frozen or unclickable.

To confirm the cause, visit a URL that forces a fresh, uncached load, such as www.yourwebsite.com?captaincompliance. If the banner works there but not on the cached page, WP Rocket is the likely cause.

WP Rocket’s documentation traces this class of issue to a change made to Delay JavaScript Execution in version 3.18.1, which exclusions do not reliably resolve, and says most cases are fixed in version 3.18.3.

Recommended solution

  1. Update WP Rocket to version 3.18.3 or later, clear the WP Rocket cache, and test the banner on a cached page.

  2. If the banner still does not respond, install WP Rocket’s helper plugin, which reverts the Delay JavaScript Execution script to the last working version: WP Rocket | Change Delay JS Execution Script.

The helper plugin has been used successfully by Captain Compliance customers. In many cases it resolves the issue without any Captain Compliance-specific exclusions or configuration.

The steps below cover the basics. Always follow WP Rocket’s official documentation for current guidance.

Install the helper plugin

Step 1: Download the helper plugin

Download the .zip file from the link above.

Step 2: Upload and activate the plugin

  1. Log in to your WordPress admin dashboard.

  2. Go to Plugins, then Add New.

  3. Click Upload Plugin.

  4. Click Choose File and select the .zip file you downloaded.

  5. Click Install Now.

  6. When prompted, click Activate.

Step 3: Clear the WP Rocket cache

  1. Go to Settings, then WP Rocket.

  2. Click Clear Cache, or use the WP Rocket option in the WordPress admin bar.

This applies the reverted Delay JavaScript Execution script to cached pages.

Step 4: Verify the fix

  1. Visit a cached page on your site. Do not use cache-bypassing URLs or logged-in previews.

  2. Click Allow, Reject, and Cookie Settings on the consent banner.

The buttons should respond immediately, and the consent state should update correctly.

Additional notes

  • The issue is specific to WP Rocket’s Delay JavaScript Execution feature.

  • Captain Compliance scripts do not require modification.

  • Once your WP Rocket version includes the fix, the helper plugin may no longer be necessary.

Related articles