Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Security · Guide

How to Add a Cookie Consent Banner to WordPress

Short answer

To add a cookie consent banner to WordPress, install a consent plugin such as CookieYes, choose an opt-in banner for visitors in the EU, and turn on cookie blocking so analytics and advertising scripts wait for consent. Link the banner to your privacy policy, add a way for visitors to change their choice later, and test it in a private browser window. The basic setup takes about 30 minutes.

Key takeaways

  • A banner must ask for consent before non-essential cookies load, not after.
  • Strictly necessary cookies, such as login and cart cookies, do not need consent.
  • CookieYes shows a working banner on activation, and its free plan covers 5,000 pageviews a month.
  • Google Consent Mode v2 passes each visitor's choice to Google Analytics and Google Ads.
  • Visitors must be able to reject cookies as easily as they accept them, and change their mind later.
  • A plugin alone does not make a site compliant; your policy and settings still matter.

A cookie consent banner is a notice that asks visitors to accept or reject non-essential cookies before your site sets them.

A cookie is a small text file that a website places on a visitor's device, and it can store data that identifies that person in some cases, according to GDPR.eu.

Cookies fall into groups by purpose:

  • Strictly necessary cookies keep login sessions and shopping carts working.
  • Preferences cookies remember language and region choices.
  • Statistics cookies count page views and clicks.
  • Marketing cookies track activity across sites for ads.

A consent banner is also called a cookie notice or a consent management platform, often shortened to CMP. The banner itself is only the visible part. Behind it, the plugin must hold back tracking scripts until the visitor chooses, record that choice, and let the visitor change it later.

You need a banner if your site sets non-essential cookies for visitors who are covered by consent rules, such as visitors in the EU.

GDPR.eu lists the core rule: receive consent before you use any cookies except strictly necessary cookies. It also says to document and store consent, and to let visitors use your service even if they refuse some cookies.

WordPress does not include a consent banner in core. The WordPress privacy documentation states that WordPress.org does not yet have consent tools built, and that plugins can help collect consent, as explained in the WordPress Privacy documentation.

A plain site with no analytics, ads, embeds, or third-party scripts may set only strictly necessary cookies. In that case a banner adds little, but you should still explain those cookies in your privacy policy.

If you use Google Analytics, Google Ads, Meta Pixel, YouTube embeds, or a chat widget, those tools set non-essential cookies or load tracking scripts. That is the common case where a banner is needed.

For the wider privacy picture, read the GDPR compliance guide for WordPress. It covers the policy, data requests, and other steps that sit beside the banner.

What do you need before you start?

You need admin access to WordPress, a list of the cookies and trackers your site sets, and a published privacy policy page.

Start with an inventory. List every plugin and service that can set a cookie or load a script: analytics, ads, forms, comments, embeds, live chat, and social buttons. A cookie scan in your consent plugin can find many of them, but check your own list first so you know what the scan should find.

Create or update your privacy policy before you switch the banner on. Go to “Settings” then “Privacy” in the WordPress admin, where WordPress can create a draft policy page with starter text from core and participating plugins.

The WordPress privacy documentation, updated on 5 April 2026, says the Editing Helper draws on WordPress core and participating themes and plugins, and that the starter text is only a starting point. You must check it against the services you actually use.

Back up your site before you install and configure a new plugin. A full backup lets you undo a bad setting in minutes, and the steps are covered in the guide to backing up WordPress.

Allow about 30 minutes for the basic setup, plus another 30 minutes to check the banner, the cookie list, and your analytics. A site with ads, several regions, or many trackers can take longer.

Install a consent plugin from the WordPress plugin directory, activate it, run its setup wizard, and turn on cookie blocking.

Step 1: Pick a plugin

Choose a plugin that is listed on WordPress.org, is updated often, and blocks scripts before consent. CookieYes and Complianz are the two most installed options, each with over 1 million active installs on WordPress.org, as of November 2026.

CookieYes is a Google-certified CMP, and its plugin page says a working banner appears as soon as you activate it, with no configuration needed. That makes it a good first choice for a small site.

The free GDPR Compliance and Cookie Consent plugin is a lighter option. Its page says it adds a banner, consent checkboxes for comments and forms, and a data request form, and it does not scan or classify cookies for you.

Step 2: Install and activate it

Go to “Plugins” then “Add New” in the WordPress admin. Search for the plugin name, click “Install Now”, then click “Activate”.

For CookieYes, the banner appears on your site right after activation. The CookieYes plugin page says the free plugin works without an account, and it lists over 1 million WordPress sites and a 4.8-star rating from more than 3,200 reviews.

Pick an opt-in banner if you serve visitors in the EU. With opt-in, non-essential cookies stay blocked until the visitor accepts. Pick an opt-out banner only if your audience is covered by opt-out rules, such as some US state laws.

CookieYes lets you choose a GDPR opt-in template or a US State Laws opt-out template. If you serve both regions, you need geo-targeting, which is a paid feature on Pro and Ultimate plans.

Step 4: Set the banner text, buttons, and position

Write short, plain text that names the cookie types you use and links to your privacy policy. Put an “Accept All” button and a “Reject All” button side by side on the first layer of the banner.

A banner with no refuse option next to the accept button is a common design fault. The European Data Protection Board taskforce report, adopted on 17 January 2023, found that a vast majority of EU authorities treat that gap as an infringement.

Add a “Customize” or “Manage preferences” button that opens categories such as necessary, functional, analytics, and advertising. Keep the banner readable on a phone, with buttons large enough to tap.

Add a “Read More” link in the banner that points to your privacy policy or cookie policy page. CookieYes can generate a cookie policy from your scan results when you connect the free web app.

Check that the link opens the right page and that the page lists the cookie categories you show in the banner. If the two do not match, visitors get mixed messages.

Group your cookies into categories, then set each non-essential category to stay blocked until the visitor accepts it.

A category is a group of cookies with one purpose, such as analytics or advertising. Visitors can accept analytics and reject advertising, so the banner must record each choice separately.

Run a cookie scan first. CookieYes offers a scanner in its free web app, with 5 scans a month of up to 100 pages each, as listed on its plugin page. The scan finds cookies and adds them to your cookie list, so blocking can cover them without manual setup.

Review the scan results by hand. Move any cookie the scanner put in the wrong group, and delete entries for tools you no longer use. A scan cannot judge whether a cookie is truly necessary, so your own inventory is the check.

Turn on automatic cookie blocking. In CookieYes, the free plugin blocks cookies you add in the cookie manager, using their script URL patterns. Blocked YouTube embeds show a placeholder until the visitor consents.

The GDPR Compliance and Cookie Consent plugin works differently. Its “Block Cookies” option stops WordPress and other PHP plugins from setting cookies until the visitor accepts, but its page says it does not stop third-party scripts such as analytics or ad tags from loading. Check those scripts separately.

If you use Google Analytics, consider whether you need it at all, or whether a lighter tool fits. The privacy-friendly analytics guide compares Google Analytics with tools that collect less data.

Google Consent Mode v2 passes each visitor's banner choice to Google tags, so Analytics and Ads adjust what they store and send.

Consent Mode is not a banner. Your banner collects the choice, and Consent Mode carries it to Google. Without it, a Google tag may not know that a visitor said no.

Google updated Consent Mode in November 2023. Version 2 adds two signals, ad_user_data and ad_personalization, to the older ad_storage and analytics_storage signals, according to Google's consent mode guide.

Google's guide says to set the default consent state before a user grants consent, and to update it after the visitor interacts with the banner. The default must be set before any command that sends measurement data.

In basic mode, Google tags stay blocked until the visitor chooses. In advanced mode, tags load with consent denied and send limited signals without cookies. Most small sites should use basic mode, because it is simpler to reason about.

CookieYes passes consent signals to Google Analytics 4, Google Ads, and Google Tag Manager in basic or advanced mode when you connect the free web app. The GDPR Compliance and Cookie Consent plugin has Consent Mode v2 on by default, with all four signals denied and a wait of 500 ms for an update.

How do you check the banner works?

Open your site in a private browser window, confirm the banner appears, reject cookies, and confirm that analytics and ad scripts do not load.

Follow this check list in order:

  1. Open a private window and load your home page. The banner should appear on the first visit.
  2. Click “Reject All”. The banner should close, and the page should still work.
  3. Open your browser developer tools, go to the Network tab, and reload. Look for requests to analytics and ad domains. They should be absent after a rejection.
  4. Accept cookies in a fresh private window, then reload. Analytics requests should now appear.
  5. Find the revisit button or footer link, open your choices again, and change one category. The change should stick after a reload.
  6. Check the banner on a phone. Buttons should be visible, readable, and easy to tap.
  7. Check a cached page. Purge your cache after changing settings, then repeat the private-window check, because a stale cache can show an old banner.

Use Google Tag Assistant to check Consent Mode. Its Consent tab shows the default state and the update after a visitor clicks, and an empty tab means Consent Mode is not running on the page.

If your site uses page caching, purge it after every settings change. Caching can also hide a broken banner, so the private-window check matters more than a check in your normal browser. For cache settings, see the guide to speeding up WordPress.

Test changes away from your live site when you can. The WordPress Playground guide shows how to run a throwaway WordPress install in the browser for a quick check.

A basic banner costs nothing, and paid plans start at $10 a month per domain for CookieYes or $59 a year for one site for Complianz, as of November 2026.

OptionFree planPaid planBest for
CookieYesBanner, blocking, cookie manager, 5,000 pageviews a monthBasic $10 a month, Pro $25 a month, Ultimate $55 a month, per domainSmall sites that want a hosted dashboard and scan
ComplianzBanner, scan, policy generator, no pageview limitPersonal $59 a year for 1 site, Professional $179 a year for 5 sites, Agency $399 a year for 25 sitesWordPress-only sites that want data kept on their own server
GDPR Compliance and Cookie ConsentBanner, Consent Mode v2, data request formNo paid plan listedSimple sites that want a light free plugin

CookieYes prices its paid plans per domain, by pageviews. Its pricing page lists Basic at $10 a month for 100,000 pageviews, Pro at $25 a month for 300,000 pageviews, and Ultimate at $55 a month for unlimited pageviews, with $0.30 per 1,000 extra pageviews on Basic and Pro.

Complianz prices by site count, not pageviews. Its pricing page lists Personal at $59 a year for 1 site, Professional at $179 a year for 5 sites, and Agency at $399 a year for 25 sites, with a 30-day money-back guarantee.

Paid features that often matter are geo-targeting, IAB TCF support, consent logs, and scheduled scans. CookieYes puts IAB TCF v2.4 on Pro and Ultimate, and its free scan covers 100 pages per scan, rising to 600 on Basic, 4,000 on Pro, and 8,000 on Ultimate.

Check prices on the vendor page before you pay. Prices change, and the figures above are as of November 2026.

What mistakes should you avoid?

The most common mistake is showing a banner that does nothing, because tracking scripts still load before the visitor chooses.

Avoid these faults:

  • No “Reject All” button on the first layer, so refusing takes more clicks than accepting.
  • Pre-ticked category boxes, which do not count as consent.
  • A banner that loads analytics before the visitor clicks anything.
  • A cookie list that does not match the cookies your site actually sets.
  • No way to change a choice later, such as a revisit button or footer link.
  • A consent expiry that never ends, so a choice from years ago still stands. The GDPR Compliance and Cookie Consent plugin uses a default expiry of 6 months, which is a sensible starting point.
  • A privacy policy that names tools you removed months ago.
  • A banner hidden behind a cache, so visitors see an old version after you fix it.

Re-check the banner each time you add a plugin, an embed, or an ad script. A new tool can add cookies that your old cookie list does not cover, and the banner will not block what it does not know about.

This guide is general information, not legal advice. If your site handles sensitive data, serves many regions, or runs ads at scale, ask a qualified lawyer to review your setup.

Frequently asked questions

Does WordPress have a built-in cookie consent banner?

No. WordPress core includes privacy tools such as a privacy policy page, personal data export, and personal data erasure, but it does not include a consent banner. You need a plugin or a consent platform to show a banner, block scripts before consent, and record each visitor's choice.

Do I need a cookie banner if I only use Google Analytics?

Yes, in most cases where your visitors are covered by consent rules. Google Analytics sets cookies that are not strictly necessary, so it should wait for consent. Turn on cookie blocking and Google Consent Mode v2 in your consent plugin, then check in a private window that no analytics request loads after a rejection.

How long should cookie consent last?

Set a clear expiry and re-ask when it ends. The GDPR Compliance and Cookie Consent plugin uses 6 months by default, and the ePrivacy guidance says persistent cookies should not last longer than 12 months. Shorter periods are safer when your cookie list changes often, because visitors then review a current list.

Can visitors change their cookie choice after they accept?

Yes, and they must be able to do it as easily as they gave consent. Add a revisit consent button or a footer link that re-opens the preference panel. Test it in a private window: change one category, reload the page, and confirm the new choice is still in place.

Will a cookie banner slow down my site?

A banner adds a small script, but the bigger effect comes from the scripts it blocks. When a visitor rejects analytics and ads, those scripts do not load, which can make the page lighter. Keep the banner script lean, purge your cache after changes, and check page speed after you switch it on.

Is a free cookie consent plugin enough for a small site?

Often yes. A free plugin can show a banner, offer accept and reject buttons, and block scripts for a small site with one region and a short cookie list. You may need a paid plan for geo-targeting, consent logs, scheduled scans, or IAB TCF support if you run ads or serve many regions.

Sources

  1. Cookies, the GDPR, and the ePrivacy Directive GDPR.eu
  2. WordPress Privacy WordPress.org
  3. CookieYes – Cookie Banner, Cookie Consent and Cookie Notice for GDPR/CCPA WordPress.org
  4. GDPR Compliance and Cookie Consent WordPress.org
  5. Set up consent mode on websites Google for Developers
  6. CookieYes Pricing CookieYes
  7. Complianz Pricing Complianz

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test