How to Add a Cookie Consent Banner to WordPress (2026 Guide)

Laptop showing a website with a cookie consent banner — add a cookie consent banner to WordPress

If your WordPress site sets cookies — and almost every site does, from analytics to embedded YouTube videos — visitors in the EU and UK must be asked before those cookies load. That is what a cookie consent banner does, and in 2026 it is no longer optional: regulators enforce it, and Google requires consent signals for ads and analytics in the EEA. You can add a cookie consent banner to WordPress in about fifteen minutes with a free plugin and no code. This guide covers choosing the right plugin, setting it up, connecting it to Google Analytics, and testing it.

Do You Need a Cookie Consent Banner on Your WordPress Site?

Probably, yes. The EU ePrivacy Directive requires consent before storing non-essential cookies on a visitor’s device, and the GDPR adds that consent must be freely given, specific, and as easy to withdraw as it was to give. These rules follow your visitors — a site run from anywhere with European readers still needs a banner.

WordPress core sets very few cookies, mostly for logged-in users. The ones that trigger the requirement come from what you added: Google Analytics, Google Ads, embedded YouTube videos, social share buttons, live chat widgets, and marketing pixels. If your site runs any of those, you need a banner. In the US, California’s CCPA/CPRA and similar laws require an opt-out instead, but a good consent plugin handles both by showing the right version based on the visitor’s location.

What a Compliant Cookie Banner Must Do

Not every banner is compliant — regulators have fined sites for banners that only look the part. Check your plugin against this list:

  • Block first, ask first. Non-essential cookies and scripts must stay blocked until the visitor consents — a banner that appears after Google Analytics has already loaded is decoration, not compliance.
  • Reject must be as easy as Accept. “Reject all” must sit next to “Accept all”. Regulators have fined sites specifically for hiding it.
  • Offer granular choice — analytics yes, marketing no — using the standard Functional, Statistics, and Marketing categories.
  • Keep a consent record of who consented to what and when; good plugins log this automatically.
  • Link to a cookie policy listing the cookies your site sets, and re-ask visitors when you add a new service.

The Best WordPress Cookie Consent Plugins in 2026

Four plugins dominate WordPress in 2026. Complianz (1+ million installs, 4.7/5) is self-hosted, so consent records stay in your own database; its free version has no pageview cap and includes a cookie scanner and generated cookie policy, and Premium from $59/year adds Google Consent Mode v2. CookieYes (1+ million installs, 4.8/5) is the fastest setup — install, connect a free cloud account, and the banner is live. The free plan covers 5,000 pageviews a month; paid plans start at $10/month. Cookiebot by Usercentrics is a Google-certified platform used on around 2.4 million sites; the free plan covers one domain with up to 50 subpages, and paid plans start at about €7/month. GDPR Cookie Compliance (Moove) is the most design-friendly free option, fully self-hosted, Premium from £59/year.

This tutorial uses Complianz: its free tier is the most generous, your consent data stays on your own server, and the setup wizard does most of the thinking for you.

How to Add a Cookie Consent Banner to WordPress

When you add a cookie consent banner to WordPress with Complianz, the process takes about fifteen minutes. Nothing here changes your content — only what loads in the visitor’s browser.

Step 1: Install Complianz

In your dashboard, go to Plugins → Add New Plugin, search for “Complianz”, click Install Now, then Activate. Everything below happens under the new Complianz menu.

Step 2: Run the Setup Wizard

Open Complianz → Settings and start the wizard. It asks which regions you target and which services your site uses — answer honestly, since the wizard uses your answers to decide which banner and documents you need. Partway through, it runs a cookie scan. Let it finish: the scan finds the cookies your plugins and embeds actually set, and it is the basis for the banner categories and the cookie policy. Re-run the scan whenever you add a new analytics tool.

Step 3: Set Your Cookie Categories

Complianz sorts the scan’s findings into four categories: Functional (always on), Preferences, Statistics, and Marketing. Check the list — the usual fixes are a YouTube embed filed under Marketing and a caching plugin’s cookie filed under Functional. Drag services into the right category — this is what visitors see under “Manage preferences”.

Step 4: Design the Banner to Match Your Site

Pick a layout — a bottom bar or a floating corner box works best — then match the colours and button text to your theme. Keep the wording plain: “We use cookies to improve your experience” beats legal jargon. Most importantly, keep the Reject button visible on the first screen; hiding it behind “Manage preferences” is the most common reason regulators fine sites.

Step 5: Add a Cookie Policy Page and Link It

The wizard can generate a cookie policy page from your scan results. Publish it, then verify the banner links to it — Complianz adds the link automatically, but check it on the front end. Your privacy policy should link to the cookie policy too.

Step 6: Test the Banner in a Private Window

Open your site in a private window, where you are not logged in. The banner should appear on the first load. Click Reject all, then open developer tools (F12), go to Application → Cookies, and confirm no analytics or marketing cookies were set. Reload, accept everything, and confirm the cookies appear. If cookies load before you click anything, a script is bypassing the banner — check its script-blocking settings and re-scan.

Developers adding scripts by hand can respect consent in code — WordPress ships a Consent API for this, in core since version 5.1:

if ( function_exists( 'wp_has_consent' ) && wp_has_consent( 'marketing' ) ) {
    // Load the marketing script only after consent.
}

Connect Your Banner to Google Analytics and Ads

If you run Google Analytics or Google Ads, the banner alone is not enough. Since March 2024, Google Consent Mode v2 requires consent signals for traffic from the European Economic Area — without them, Google stops personalising ads and models your analytics data instead of measuring it.

Complianz Premium and CookieYes both send Consent Mode v2 signals out of the box: accepting Statistics tells Google to enable analytics storage; declining keeps it off. If you added Analytics through Google Tag Manager, make sure the tag fires only after the consent signal. I have covered both tools separately: how to add Google Analytics to WordPress and how to add Google Tag Manager to WordPress.

5 Cookie Banner Mistakes That Get Sites Fined

  1. Pre-ticked consent boxes. Consent must be an active choice. A pre-ticked “accept marketing cookies” box is not consent under the GDPR.
  2. Loading analytics before consent. The most common technical failure: the banner is up, but the analytics tag fires on page load anyway. Test with the banner rejected, as in Step 6.
  3. No visible Reject button. “Accept all” in a bright button and “Manage preferences” in tiny grey text is a dark pattern. Give Reject equal weight.
  4. Forgetting embeds. A YouTube video on your homepage sets cookies the moment the page loads, banner or not. Consent plugins handle this with a placeholder that only loads the video after the visitor agrees to Marketing cookies.
  5. Never re-scanning. Every new plugin can add cookies. Re-run the scan after installing anything that touches the front end.

How to Test Your Cookie Banner

After setup, re-check the banner in a private window after every plugin update: with the banner rejected, no analytics or marketing cookies should exist, and on a phone the buttons must be tappable and the text readable without horizontal scrolling. For the wider security picture, see my WordPress security hardening checklist.

Frequently Asked Questions

Is a cookie banner required by law?

It depends on your visitors’ location. Anyone in the EU or UK triggers the ePrivacy Directive and GDPR requirement for consent before non-essential cookies load. US state laws generally require an opt-out instead, which the same plugins handle with a region-aware banner.

Does WordPress have a built-in cookie banner?

No. WordPress core has no consent banner — its privacy tools only cover the privacy policy page and data export. A plugin is required.

Adding a cookie consent banner to WordPress is a fifteen-minute job that protects your visitors’ privacy, keeps you on the right side of European law, and keeps your Google Analytics data flowing. Install Complianz or CookieYes, run the wizard, test with the banner rejected, and you are done. If you would like help with privacy setup or anything else WordPress, take a look at my services or get in touch through my contact page — I would be glad to help.