Cookies and Content Security Policy


Be fully GDPR and CCPA compliant through Content Security Policy.

Block cookies and unwanted external content by setting Content Security Policy. A modal will be shown on the front end to let the visitor choose what kind of resources to accept. It also adds a layer of security for your site since iframes, scripts and images from unknown domains are blocked.

Multilingual support through WPML, Polylang or probably any multilingual plugin out there since this plugin follows WordPress Coding Standards. See FAQ below on how to translate with WPML or Polylang.

Quickstart: Choose common resources from a list that are automatically added to your Domains list. So, it’s even easier to set it up! Check, check, check and check!
Updated regularly.

Free stickers for translators!

Since we want this plugin to be available in as many languages as possible, I will send you a handful of the new super cool stickers if you translate the plugin!
Just translate the plugin to your language, and when it is approved, comment this post and I’ll send it to you, totally free!
If you have already translated the plugin and want stickers, of course that counts too! Just comment the post.


  • First modal, when using default colors.

  • Second modal, when using default colors.

  • Banner, when using default colors. Replaces First modal, when the setting “Do not use a modal, I want a banner.” is used.

  • First modal, example of customized colors.

  • Second modal, example of customized colors.

  • Banner, example of customized colors.

  • Activate, by default when installing, the plugin is deactivated, choose admin to test your settings before going live just to check out if everything works.

  • Quickstart, choose from a long list of common resources to get started super quick.

  • Domains, this is where you white list all the domains where you allow content to be served from.

  • Texts, use the default texts or write your own. This is also fully multi language supported.

  • Settings, cusomize it how you like it.

  • Colors, without knowing css or anything, customize the colors to fit your site.

  • Look in console to see what is blocked. In this case you’d probably like to add to Experience > Script. Or just use Quickstart and choose Twitter.


Search for Cookies and Content Security Policy under Plugins on your WordPress install or download and:

  1. Upload cookies-and-content-security-policy to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Go to Settings > Cookies and Content Security Policy

Preguntas frecuentes

Does this make my site GDPR compliant?

Yes, if you set it up right.

Does this make my site CCPA compliant?

Yes, if you set it up right.

How do I know what resources are used on my site?

After install, open a console (see screenshot 13) and see what is blocked by Content Security Policy. Then just go to WP Admin > Settings > Cookies and Content Security Policy > Domains and add the domains you want to allow. Or you can take a look at WP Admin > Settings > Cookies and Content Security Policy > Quickstart, and see if the resource you want to use is there.

How do I manually add domains to allow?

After install, open a console (see screenshot 13) and see what is blocked by Content Security Policy. If you get the error message: Refused to load the script '' because it violates the following Content Security Policy directive: "script-src [...] in the console, you should add to Script, since is the domain of the URL that caused the error, and script-src is the directive. If it is Always allow, Statistics, Experience or Marketing is up to you.

The settings does not seem to have an effect. What do I do?

There are three scenarios where this can happen:

  • In some cases cookies are cached. It could be your hosting (for example WP Engine does this), then just contact them and ask them to uncache the cookies_and_content_security_policy cookie, or you can check “WP Engine compatibility mode” under Settings.
  • In other cases it could be your cache plugin (for example Litespeed cache does this), then just review your settings. Read more in the next question in the FAQ that is all about cache plugins.
  • If you’re using static page cache that doesn’t go through php, go to Settings > Cookies and Content Security Policy > Settings and check Use meta under Advanced settings.

I’m using a cache plugin, and it seems to be interfere with this plugin

Review the settings of you cache plugin.


  • Litespeed cache, go to WP Admin > LiteSpeed Cache > Cache > Excludes, scroll down to “Do Not Cache Cookies” and enter cookies_and_content_security_policy and save your changes.
  • Hummingbird, go to WP Admin > Hummingbird > Caching, scroll down to “Exclusions” and in “Cookies” enter cookies_and_content_security_policy and save your changes.
  • WP Fastest Cache, go to WP Admin > WP Fastest Cache > Exclude, scroll down to “Exclude Cookies” and click “Add New Rule” and enter cookies_and_content_security_policy and save.

Can you show me some examples of sites using this plugin?

In English

  • – Transladed strings in Polylang, works in the same way with WPML
  • – Transladed strings in Polylang, works in the same way with WPML
  • – Transladed strings in Polylang, works in the same way with WPML
  • – Transladed strings in Polylang, works in the same way with WPML

In Swedish


Is the plugin responsive?


Is the plugin translatable?

Yes, all texts are translatable. There are 10+ languages already translated. And if you want to contribute with a translation of your own language, please do! <3 All texts on the front end can be changed directly in the admin. And if you are using WPML, Polylang, or some other multilanguage plugin, there is also support for multilanguage translations.

How do I translate in WPML?

  1. Make sure you have “WPML String Translation” installed.
  2. Go to Settings > Cookies and Content Security Policy > Texts and save your texts.
  3. Go to WPML > String Translation.
  4. Search for “cacsp_” (without quotes).
  5. Click the plus sign to add translation.
  6. If you have a string named “cacsp_option_settings_policy_link”, the value is a number. It is the ID of the Cookie policy page. Translate this by entering the ID of the cookie policy page in the language you are translating to.

How do I translate in Polylang?

  1. Go to Settings > Cookies and Content Security Policy > Texts and save your texts.
  2. In the WordPress admin bar, choose “Show all languages”.
  3. Go to Languages > Strings translations.
  4. In the “View all groups” dropdown, choose cookies-and-content-security-policy, and click “Filter”.
  5. Translate your texts in the form.
  6. If you have a string named “cacsp_option_settings_policy_link”, the value is a number. It is the ID of the Cookie policy page. Translate this by entering the ID of the cookie policy page in the language you are translating to.

Can I change the look of it?

Yes, there are settings for using a modal or a banner. Also you can choose if the site should be locked behind the modal or if the site should be usable without setting your preferences. You can also change the colors of everything. And if you want you can disable the css entirely and use your own.

Does it include a cookie policy page?

No, but you can make your own, and in the settings you can select it and the modal won’t show there so that the user can read it without accepting first.

What if the user wants to change their settings?

You can add a link anywhere on your site that links to #cookiesAndContentPolicySettings and clicking that will open the settings.

Are the css and js files minified?

Yes, but you also get them unminified and the css also comes as SASS so you can change anything.

Can I bypass the plugin for testing purposes?

Yes, just add the querystring ?cacsp_bypass=true to your url, when running speedtest in Gmetrix for instance. It will set a session cookie that accepts all Domains you’ve set.

Does it work with page builders?

Yes! Not all are tested, but all tested works!

These have been tested:

  • Divi
  • Beaver Builder
  • WPBakery Page Builder
  • Elementor

Does it work with Multisite?

Defenetly! Just go to Network Admin > Settings > Cookies and Content Security Policy and choose how you want it to work.

You can choose if all settings should be individual for each site, all settings should be fetched from your main site, or if all settings except texts should be fetched from your main site.

Does it support Google Consent Mode v2?

Yes, it does! You can activate it in Settings > Cookies and Content Security Policy > Settings > Advanced settings > Enable Google Consent Mode v2


18 de junio de 2024
This plugin is awesome, thank you! Compared to the others, there is no account required to block Google Maps / Analytics cookies based on consent. Plus, it is easy to change colors, texts, and translate them with WPML 🙂
4 de junio de 2024
I started a thread asking for Cloudflare Turnstile to be added to quickstart and received a promise to implement the feature 🙂
7 de mayo de 2024
Best Cookies plugin. Easy to use but many settings here! I will donate you for your job guys! 🙂
12 de marzo de 2024
Great plugin. Easy to implement, work great. Quick help in case of problems. I’ve heard that even the Spanish Inquisition uses it on their website 🙂
Leer todas las 57 reseñas

Colaboradores y desarrolladores

Este software es de código abierto. Las siguientes personas han contribuido a este plugin.


“Cookies and Content Security Policy” ha sido traducido a 19 idiomas locales. Gracias a los traductores por sus contribuciones.

Traduce “Cookies and Content Security Policy” a tu idioma.

¿Interesado en el desarrollo?

Revisa el código, echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios


  • Tested up to 6.5.2
  • Better Google Consent Mode v2. Thanks to @ycdevs for the help!


  • New setting for bypassing by IP accepting all cookies, great for testing tools
  • Better timing of http headers
  • Better Google Consent Mode v2


  • Spelling fixes
  • Bug fix for “content not allowed” message not appearing


  • Bug fix for Google Consent Mode v2


  • CSS fix for overlay
  • Support for Google Consent Mode v2


  • Vars file removed from SVN, since it’s not used anymore
  • Removed log from js
  • Updated FAQ


  • Update check


  • Move error message from php to js for better speed.


  • Rebuild js


  • Only load js-cookie if it’s not already loaded
  • Allow html in help text for WP Engine setting in admin
  • Possibility to hide admin email in error messages
  • Minor text fixes in admin


  • Google Analytics: Save referrer
  • Better versioning of js-file


  • Changed _e to esc_html_e in admin to work better with different languages
  • Fix combination issue of “Do not use a modal, I want a banner” and “Show close button” on small screens in Safari


  • Spelling fix
  • Translation file
  • Disable content not allowed, bugfix


  • Cookie policy page ID in debug
  • Possibility to disable error message for blocked iframes
  • Added color setting for disabled switch
  • Correct color setting for off switch
  • Fix for Divi admin


  • Add required files
  • Tested on 6.1


  • Possibility to use global settings for multisites
  • Quickstart: Update for Hubspot
  • Quickstart: Update for Facebook pixel
  • Updated uninstall


  • Quickstart: Update for Hubspot forms
  • New setting: Set your own timeout for when you want the cookie modal to appear
  • Admin language fixes
  • Javascript minified fix


  • Quickstart: Update for Hubspot
  • Quickstart: Update for Google Ads
  • Quickstart: Update for LinkedIn
  • Quickstart: Update for Google Analytics


  • Ensure box-sizing is border-box
  • Check if frame or object is valid when loaded dynamically


  • Quickstart for Divi
  • Translation template update


  • Support for custom WP Engine header, found in Settings. Thanks @khromov for adding this!
  • Tell WP Super Cache (if used) to cache requests with the cookie “Cookies and Content Security Policy” separately from other visitors. Thanks @mikewpdev for the suggestion and pointers!
  • Enqueue css earlier for easier overwrite in themes
  • Better support for Google Ads in Quickstart


  • Better Quickstart for YouTube
  • Bug fix for “Allow user to access site without saving settings” in Safari
  • Bug fix for “Possibility to add a close modal X” after closing modal scroll didn’t appear


  • Minor fixes in Readme
  • Quickstart for Instagram
  • Quickstart for Googlea Docs
  • Function get_plugin_version renamed to cacsp_get_plugin_version, to avoid possible conflicts
  • Possibility to add a close modal X to close the modal and refuse all unnecessary cookies, found in Settings
  • Bug fix for bypassing with ?cacsp_bypass=true


  • Extra check added to make sure the modal or banner doesn’t appear in the Widget block editor
  • Updated language files
  • Updated FAQ
  • Updated Support tab


  • Bug in error message for framed domains under Always allowed fixed


  • Not a major update, just the version number after 1.99 🙂
  • Translation bug that gave the default site language in WP Admin for all users, fixed.
  • Possibility to change after how many days the accept cookie should expire. If you don’t change it, the default is 365 days. The setting is found under Settings.


  • Better URL match for error messages
  • Better Quickstart for Twitter images


  • Add forgotten file


  • Updated jQuery code from using deprecated click()
  • Updated to latest js-cookie
  • Position of Grandma
  • Updated Readme with path example for Bedrock
  • Changed site_url() to home_url() in error message to get the right domain in error message function


  • Vars file moved to make sure it’s not deleted on update
  • Bug fix for embedded PDFs in Gutenberg block


  • Better Quickstart for LinkedIn
  • Wildcard for Doubleclick when setting up Google Ads with Quickstart


  • Vars file added for all of you weird path people out there, I’m looking at you Bedrock 😉
  • Hubspot iframe for posting forms added to Quickstart
  • Googleapis domain for Google Maps added to Quickstart


  • Mime type specified for error message file
  • Wildcard domain for YouTube images in Quickstart


  • Fix for keeping cookie settings across sessions in iOS


  • Add file for allowed domains


  • Allowed domains for error message moved to separate file for better support for cache plugins
  • Fix for cookie message appearing in WordPress 5.8 block widgets


  • Deep link to #cookiesAndContentPolicySettings
  • Better readability in debug
  • Possibility to disable unsafe-inline
  • Possibility to disable unsafe-eval


  • Domain Path
  • Mailchimp added to Quickstart


  • added to Quickstart for Google Maps frame.


  • Quickstart for Jetpack
  • Body position for CLS
  • Better flex for scroll in settings modal


  • Google in Quickstart checkboxes


  • Patch: Bug found in “Only reload page when accepting” from 1.83


  • Bust cache for js and css when new version of the plugin gets installed
  • Faster enqueue of js and css, millisecond(s) faster, but on big sites …
  • Compact custom css
  • Only reload page when accepting if there are visible blocked elements, like iframes and images. Otherwise just hide the modal and save the settings.
  • Added Calendly to Quickstart
  • Categorized resources in Quickstart
  • Domains for all Google resources updated in Quickstart
  • Better description on how to work with translation plugins


  • Text domain
  • Improvement of Google Analytics in Quickstart


  • Tested up to 5.7.
  • Patch bug that appeared in 1.80 when saving Settings in admin. Where Cookie policy target gave a warning when saving if it was not checked.
  • Better check for double domains in Quickstart, no more double new lines.
  • Added posibility to allow blob:. Found under Settings > Advanced settings.
  • and added to Quickstart for Google Maps.


  • Added posibility to add worker. Found under Settings > Advanced settings. Then just add your worker-domains under Domains.
  • Alternative link to cookie policy for those of you who have the policy on a different domain, in a PDF or something else.
  • Option to open your cookie policy in a new tab.
  • Accept cookies cookie has now SameSite set to strict.
  • Accept cookies cookie set to secure for SSL sites.


  • Patch bug in Quickstart for Twitter
  • Added and to Quickstart for YouTube
  • Added to Quickstart for Google Analytics
  • Updated text about static cache
  • Descriptions for settings moved to own row, to make settings easier to skim through


  • Google Translate without the extra t
  • Tested up to 5.6.1
  • Helpful tip on static cache
  • Screenshot of console


  • Update of Quickstart for reCAPTCHA v3


  • Possibility to hide unused sections in Settings. Example: If you don’t have any domains specified for Marketing, that setting won’t show for the visitor. Found under Settings > Basic settings


  • Patch bug found by @stafca in possibility to disable X-Content-Security-Policy. Thanks!


  • Capitalise company names correctly
  • Possibility to disable X-Content-Security-Policy. Found under Settings > Advanced settings
  • New optional button for refusing all cookies. Found under Settings > Basic settings


  • Minor translation fixes
  • Update of Quickstart for reCAPTCHA v3


  • Individual height of warning messages for blocked iframes and objects improved


  • Button width not based on flex basis on small screens
  • New Quickstart: Twitter


  • Updated Quickstart for Google Maps


  • Custom color for Save button border was used for background too.


  • Translations and spelling
  • We have Finnish translation!


  • Minor typos
  • Added to Quickstart: Google Translate
  • Hubspot in Quickstart is out of beta


  • Better string translation in WPML
  • Support for multiple cookie policy pages, one for each language, on multi language sites
  • Bypass querystring added to make testing easier, when testing speed in Gmetrix for instance, you don’t want anything blocked. Just add ?cacsp_bypass=true to your url when testing.


  • Grandma mode


  • Tested for CCPA compliance
  • Changed the expiry of consent to 1 year, so this can be stated in the cookie policy page for CCPA compliance, the default “Settings text” has been updated to show this
  • New icon and banner, cookie and grandma drawn by Hedda Fager
  • New screenshots
  • Fixed typo in WPML FAQ
  • Disable scroll on page when settings modal is shown, gave double scrolbars when unsing “Allow user to access site without saving settings”


  • Added to Quickstart: SoundCloud
  • No outline on clicked setting in modal



  • Quickstart, out of beta
  • Quickstart, more resources added: Google Optimize, Google Ads conversions, Google Ads remarketing, Hubspot and reCAPTCHA v3
  • Bugfix for iframes and objects without src attribute


  • Translations


  • Translations


  • Adding refactored files


  • Refactoring of settings
  • Quickstart, choose common resources from a list that are automatically added to your Domains list


  • Make site clickable when using “Allow user to access site without saving settings”


  • googleoff: index added for modal and banner to be absolutely sure that the content of these doen’t get indexed by google
  • Fix for Safari on iOS 13 and the setting “Allow user to access site without saving settings”


  • Disable UI warning messages for hidden iframes, like Hotjar and so on


  • Rogue c


  • Spelling Marketing can be tricky 😉


  • Version number for automatic updating


  • Blocking object with the same rules as for iframe, to secure old style flash embeds, like for example old YouTube embeds
  • Support tab
  • Better support for // urls


  • Tested up to WordPress 5.5


  • Fix for “Only use CSP” option. Don’t try to show UI error message.


  • WordPress 5.5 ready


  • Translations and spelling


  • By popular demand: Plugin is now deactivated on install. You can also activate the plugin only for administrators to test your settings without disturbing your visitors.


  • Since translations is only available in API through Polylang Pro, I rewrote the error messages for blocked iframes in oldschool js to make error messages appear translated in the free version of Polylang.


  • Admin css
  • Translations


  • Tested up to 5.4.1
  • Translations


  • Bug fix, allow scroll on html element when option “Allow user to access site without saving settings. Only works with banner.” is checked.


  • IE11 support


  • Css for accepted type


  • Check for blank iframes


  • Uninstall for new values


  • Encode js mail link subject


  • Support for X-Content-Security-Policy
  • Better debug placement
  • Advanced settings
  • Visible warning for blocked iframes
  • Saving bug in mobile Safari fixed
  • More help texts
  • No texts must be edited, everything has default values


  • Versioning, SVN is not my friend


  • Added possibility to use the settings as a meta tag instead, if the host does not accept setting php header()


  • Translations


  • Coding standards


  • WP_DEBUG, clean


  • Added support for forms


  • Screenshot text, and active settings value


  • Assets


  • Assets and Contributors


  • Ready for the world!


  • List width


  • Minor fixes


  • Securing


  • Sanitize


  • Nonce


  • Uninstall


  • WPML config for Cookie policy page id


  • Admin referrer


  • Initial release