Platform

Cookie Consent for WordPress (No Plugin Needed)

By Published 13 July 2026

To add a cookie consent banner to WordPress, paste Consentfolio's script tag into your site's <head> and publish. It works on any WordPress theme or page builder, needs no plugin, and blocks trackers until your visitor consents. It costs £9 per domain per month, and the banner meets UK PECR and GDPR out of the box.

No plugin means no plugin conflicts, no dashboard bloat, and one tag that loads the same way on every page of your WordPress site.

  1. Create your project in Consentfolio and copy the snippet. Add your domain, then copy the two-line snippet from the Install tab. It includes the Google Consent Mode defaults and the Consentfolio tag.
  2. Open your WordPress site's <head>. You have three routes: a header-scripts plugin such as WPCode, your theme's built-in header or custom-code option, or header.php in a child theme.
  3. Paste the snippet high in the <head>, above Google Tag Manager or gtag.js. Order matters: Consentfolio sets Consent Mode to denied before your tags run, so it has to load first.
  4. Save and publish.
  5. Check it. Open your WordPress site in a private window. The banner should appear, and your analytics should stay off until you accept.

[Screenshot: the Consentfolio snippet pasted into the WordPress header via the WPCode plugin.]

WordPress quirks worth knowing

WordPress has a few habits that break cookie banners if you ignore them.

  • Caching plugins. WP Rocket, W3 Total Cache and LiteSpeed Cache can defer, combine or minify scripts. Exclude the Consentfolio tag from JavaScript deferral and combination so it loads early in the <head>. A deferred consent tag lets your other tags fire first, which fails PECR.
  • Existing consent plugins. Remove any current cookie plugin, such as CookieYes, Complianz or GDPR Cookie Consent, before you add Consentfolio. Two banners on one site confuse visitors and each other.
  • Page builders. Elementor and Divi render pages their own way. Add the tag through your theme header or a header plugin, not inside the builder, so it loads on every WordPress page rather than only builder pages.
  • WooCommerce. Your store's marketing and analytics tags need consent like any other. The tag in the <head> covers the whole WooCommerce site, including checkout, and blocks those tags until the shopper agrees.

Why one tag beats a plugin

A cookie plugin runs inside WordPress, so it competes with your other plugins, adds load to every request, and ties your consent setup to your WordPress install. Consentfolio runs from a script tag served on our side. Your WordPress site stays lighter, and the same tag works if you later move part of your site off WordPress. See how cookie consent works for the mechanics.

Consentfolio blocks trackers before consent, records provable consent per domain, and sends Google Consent Mode v2 signals to GA4 and Google Ads. Read the Google Consent Mode v2 guide and how to block Google Analytics until consent.

Frequently asked questions

Do I need a WordPress plugin for cookie consent? No. Consentfolio installs with one script tag in the <head>. You can add it through a header plugin, your theme, or a child theme's header.php, and no consent plugin runs on your site.

Does it work with WP Rocket and other caching plugins? Yes. Exclude the Consentfolio tag from JavaScript deferral, combination and minification so it loads early in the <head>. Every major caching plugin has an exclusion setting.

Does it work with Elementor, Divi and other page builders? Yes. Add the tag through your theme header or a header plugin so it loads on every page, not only builder pages.

Does it work with WooCommerce? Yes. The tag covers the whole store, including checkout, and blocks marketing and analytics tags until the shopper consents.

Is my WordPress site compliant once I add it? The banner is built for UK PECR and GDPR: prior blocking, an equal-prominence reject button, and provable records. You still choose which cookies to declare. See UK cookie law explained.


Written by Tudor Rusmanica, founder of Consentfolio. Tudor has spent over a decade in agency SEO, working where search performance meets data protection: the analytics, tagging and consent setups that keep measurement useful and lawful. Connect on LinkedIn.

Published 13 July 2026. Prices in GBP and correct at publication.

Questions? consentfolio.com · This guide is general information, not legal advice.