How to exclude beautiful cookie banner from WP Rocket Plugin plugin

WP Rocket is a caching plugins that helps speeding up your WordPress website.

Depending on the WP Rocket Settings you choose it might interfere with the cookie banner. You recognize this by “weird” behavior of the banner, e.g. loading very late or no loading always.

In order to fix that, you need to exclude the beautiful cookie banner script from being optimized with WP Rocket. If you are uncertain if WP Rocket is causing this behavior you can add ?NOWPROCKET=1 to the URL. This disables WP Rocket Plugin.

Step 1: In your WP Admin Dashboard navigate to Settings > WP Rocket

Step 2: Click the “File Optimization” tab and go to the Javascript Files section.

Step 3: In the “JavaScript Files” section, you’ll find minimizing JavaScript files, deferring JavaScript loading, and delaying JavaScript execution. When you activate any of these options, a text field labeled “Exclude JavaScript Files” will appear.

Step 4: For each selected option paste


into the text field labeled “Exclude JavaScript Files”. This will exclude the JavaScript files from being optimized.

Reminder: Those scripts need to be excluded from ALL JavaScript optimisations, e.g. deferred, minimizing or any other available option.

Step 5: Go to “Combine JavaScript files” and add in the Excluded Inline JavaScript field the following:


Step 6: Add Cookie Banner CSS to safelist

If you have enabled the “remove unused CSS” in WP-Rocket, see here, add this ID to the safelist to exclude it from optimizing:


Step 7: Now save your changes. There shouldn’t be any issues now with your cookie banner. If you still have any issues please check the WP Rocket documentation: or contact support.