WP Rocket is a caching and optimization plugin that speeds up WordPress sites. Some of its file optimizations can interfere with the cookie banner. This page lists the WP Rocket settings that matter and the exclusions to add. For other optimization plugins, see problems with speed optimizer and caching plugins.
Which WP Rocket settings affect the banner
You notice a conflict by “weird” behaviour: the banner loads very late, not on every page, without styles, or consent signals arrive after your tags. These settings can cause it:
| WP Rocket setting | Effect on the banner | Fix |
|---|---|---|
| Minify / combine JavaScript files | Banner and consent scripts are merged and their order can change | Steps 3–5 |
| Load JavaScript deferred | The consent default runs after your tags | Step 4 |
| Delay JavaScript execution | The banner only appears after the first scroll or click | Step 4 |
| Remove unused CSS | The banner’s styles are removed, the banner is unstyled or invisible | Step 6 |
| Page cache | Changed banner settings show up only after the cache is cleared | Step 7 |
Check whether WP Rocket causes the problem
Add this to the URL of the page:
?wpr_imagedimensions=1&nowprocket=1&no_optimize=1It disables WP Rocket for this one page load. If the banner works now, continue with the steps below.
Steps to exclude Beautiful Cookie Banner from WP Rocket
Step 1: in your WordPress admin, go to Settings > WP Rocket.

Step 2: open the File Optimization tab and go to the JavaScript Files section.

Step 3: the JavaScript Files section contains minifying JavaScript, loading JavaScript deferred and delaying JavaScript execution. When you activate one of them, a field Excluded JavaScript Files appears.

Step 4: for each active option, paste this into its exclusion field:
/wp-content/plugins/beautiful-and-responsive-cookie-consent-addon/(.*)
/wp-content/plugins/beautiful-and-responsive-cookie-consent/(.*)Reminder: these scripts need to be excluded from all JavaScript optimizations: minify, defer, delay and any other option you use.
Step 5: if your WP Rocket version shows Combine JavaScript files, add the following to its Excluded Inline JavaScript field:
nsc_bara_blocking_scripts_inline
nsc_bara_blocking_scripts
nsc_bara_consent_mode_default_script
nsc_bara_consent_mode_update_script
nsc_bar_get_dataLayer_banner_init_script
nsc_bar_nice-cookie-consent_js
nsc_bara_gtm_loader_js-js-before
nsc_bara_gtm_loader_js-jsStep 6: if you have enabled Remove unused CSS (tab File Optimization, section CSS Files), add these entries to the CSS safelist:
nsc_bar_nice-cookie-consent-css
nsc_bar_nice-cookie-consent-inline-css
cc-main
cm__body
/wp-content/plugins/beautiful-and-responsive-cookie-consent-addon/public/css/(.*).css
/wp-content/plugins/beautiful-and-responsive-cookie-consent/public/(.*).cssStep 7: save the settings and clear the WP Rocket cache. Test in a private browser window.
If you still have problems, see the WP Rocket file optimization documentation, the troubleshooting page, or contact support.