Product
Security
AI & SEO
Solutions
Compare
Resources
Get early access Talk to us
Guide

How to add a WordPress cookie consent banner that really blocks trackers

A banner on the screen is not the same as consent. Here is how to add a cookie consent banner to WordPress, finish the setup most people skip, and prove in five minutes that it holds trackers back.

Two WordPress pages with a cookie banner: on one, Google Analytics, Meta pixel and YouTube load before the visitor chooses; on the other, they wait until Accept all
A banner that shows a message is not enough. The trackers have to wait for the answer.

The short answer

To add a cookie consent banner to WordPress, list what your site loads, install a consent tool, finish its setup (scan, categories, blocking), set Accept all and Reject all with equal weight, connect Google Consent Mode v2, then test in a private window that no tracking cookies appear before you click. Most guides stop at installing a plugin, but on our test site no plugin held anything back until its setup was finished.

  1. List what your site loads. Write down every tracker and embed on the site: analytics, advertising pixels, chat widgets, call tracking, YouTube or Maps embeds and anything pasted into the header. A browser private window and the Network tab show what loads on a first visit.
  2. Choose how the banner will run. Pick a WordPress plugin, a hosted consent service added with a header script, or a management platform that runs the banner across many sites. Check the free plan limits and where consent records are stored before you commit.
  3. Install it and finish the setup. Activate the tool, then finish its setup: run the cookie scan, confirm the categories, and switch blocking on. Most tools need this step finished before they block anything.
  4. Set the banner wording and buttons. Show Accept all and Reject all with the same weight on the first layer, add a way to choose by category, and link your cookie policy and privacy policy. Do not pre-tick any category except strictly necessary.
  5. Connect Google Consent Mode v2. If you use Google Analytics or Google Ads, switch on Consent Mode v2 in the tool so Google tags get the visitor's choice. Choose basic mode unless you have decided advanced mode is right for you.
  6. Clear caches and test in a fresh browser. Empty every page cache and your CDN, open the site in a private window, and check in DevTools that no tracking cookies or tracker requests appear before you click, after Reject all, and only after Accept all.

Disclosure: WPCentrify is our product and one of the tools mentioned. Facts about other tools come from each vendor's own pages, checked 8 November 2026. This guide is general information, not legal advice.

Do you need a cookie banner on your WordPress site?

Probably, if your site uses analytics, advertising pixels, embedded videos, maps or chat, and people from the EU, UK or other places with consent rules visit it. The EU ePrivacy rules say storing or reading information on a visitor's device needs their consent unless it is strictly necessary for a service they asked for. The UK regulator says the same, and adds that refusing must be as easy as accepting.

A quick way to decide:

Do you need a cookie banner on WordPress
Your siteBanner needed?
Only WordPress itself, no analytics, no embeds, no pixelsOften not. WordPress's own cookies are mostly for logged-in users and commenters who opt in.
Google Analytics, Google Ads or a tag managerYes, for visitors where consent rules apply
Meta, TikTok, LinkedIn or other ad pixelsYes
YouTube, Vimeo or Google Maps embedsUsually yes, because the embed sets its own cookies
Live chat, call tracking or heatmapsUsually yes, unless the tool sets nothing on the device
Visitors in California and you sell or share personal informationYou need an opt-out route and should respect Global Privacy Control

This is general information, not legal advice. Laws differ by country and state, and a lawyer can tell you what applies to your business.

Which cookies come from WordPress, and which come from your plugins?

WordPress itself sets very little for an ordinary visitor. According to the WordPress handbook, it sets login cookies for people who sign in and commenter cookies for people who leave a comment. Since WordPress 4.9.6, commenters choose whether their details are saved in a cookie. Almost everything else comes from what you added:

Where cookies on a WordPress site come from
SourceCookies you will often seeNeeds consent?
WordPress loginwordpress_logged_in_*, wordpress_sec_*No, strictly necessary for signing in
WordPress commentscomment_author_*Only set when the commenter opts in
Google Analytics 4_ga, _ga_*Yes
Google Ads and conversion linker_gcl_auYes
Meta pixel_fbp, and fr on facebook.comYes
Microsoft Clarity_clck, _clskYes
YouTube embedsYSC, VISITOR_INFO1_LIVE on youtube.comYes
WooCommerce cart and sessionwoocommerce_cart_hash, wp_woocommerce_session_*No, needed for the cart to work

If you paste tracking code into your theme header, that code sets cookies on every page whether or not a banner is showing. Our guide to adding tracking code to WordPress covers where that code usually lives.

A cookie notice tells people the site uses cookies. Cookie consent asks first and waits. With consent, analytics and advertising cookies stay blocked until the visitor accepts them, and a visitor who rejects them never gets them. A notice that says "by using this site you agree" while the trackers load anyway is a notice, not consent.

What does a compliant cookie banner need?

Regulators in the EU and UK agree on most of the basics. The European Data Protection Board's cookie banner report, the French regulator CNIL and the UK ICO all point the same way:

  • Nothing non-essential runs before the visitor chooses. Analytics, pixels and embeds wait.
  • Reject all is as easy as Accept all. Same layer, same weight, one click each.
  • No pre-ticked boxes. The EU Court of Justice ruled in Planet49 that a pre-ticked box is not consent.
  • Choices by category, such as analytics and marketing, behind a "manage" button.
  • Closing the banner is not consent. A visitor who closes it has not said yes.
  • A way to change your mind, such as a small button on every page that reopens the choices. Withdrawing must be as easy as giving consent.
  • A record of each answer. GDPR Article 7(1) says you must be able to show that someone consented.
  • Links to your cookie policy and privacy policy.

How to add a cookie consent banner to WordPress, step by step

These six steps work whatever tool you choose.

  1. List what your site loads. Write down every tracker and embed on the site: analytics, advertising pixels, chat widgets, call tracking, YouTube or Maps embeds and anything pasted into the header. A browser private window and the Network tab show what loads on a first visit.
  2. Choose how the banner will run. Pick a WordPress plugin, a hosted consent service added with a header script, or a management platform that runs the banner across many sites. Check the free plan limits and where consent records are stored before you commit.
  3. Install it and finish the setup. Activate the tool, then finish its setup: run the cookie scan, confirm the categories, and switch blocking on. Most tools need this step finished before they block anything.
  4. Set the banner wording and buttons. Show Accept all and Reject all with the same weight on the first layer, add a way to choose by category, and link your cookie policy and privacy policy. Do not pre-tick any category except strictly necessary.
  5. Connect Google Consent Mode v2. If you use Google Analytics or Google Ads, switch on Consent Mode v2 in the tool so Google tags get the visitor's choice. Choose basic mode unless you have decided advanced mode is right for you.
  6. Clear caches and test in a fresh browser. Empty every page cache and your CDN, open the site in a private window, and check in DevTools that no tracking cookies or tracker requests appear before you click, after Reject all, and only after Accept all.

Which kind of tool should you choose?

Three ways to run a cookie banner on WordPress
ApproachHow it worksGood forWatch for
WordPress pluginInstalled from the plugin directory and set up in wp-adminOne site, and people who want settings inside WordPressFree plan limits, and whether scans or records run in the vendor's cloud
Hosted consent serviceA script from the vendor added to your header, managed in the vendor's web appSites on several platforms, not only WordPressPageview limits, per-domain pricing, and the script loading before your trackers
Management platformThe banner runs on each site from a dashboard you also use for other site workAnyone running many WordPress sitesWhether it is a Google-certified CMP if you need one for ads

If you want a shortlist of tools, our comparison of the best cookie consent plugins for WordPress looks at nine of them.

How do you test that your cookie banner really blocks trackers?

A banner on the screen proves only that the banner loaded. To check blocking, look at what the browser stores and sends. It takes about five minutes:

  1. Empty your caches. Clear your caching plugin, your host's cache and any CDN, so you test the current page.
  2. Open a private window so no earlier choice is remembered.
  3. Open DevTools before the page loads (F12, or right-click and Inspect). Keep the Network tab open, then load your homepage.
  4. Do not click the banner. In the Network tab, search for google-analytics, googletagmanager, facebook, clarity and youtube. In Application, open Cookies and look for the names in the table above.
  5. Click Reject all, reload, and check again. Nothing new should appear.
  6. Open a new private window, click Accept all, and check that the trackers now load. If they do not, your banner is blocking too much.

Two things are allowed before consent: strictly necessary cookies, such as the cookie that remembers the visitor's choice, and, if you chose advanced Consent Mode, cookieless pings to Google. Anything else that appears before a choice is a tracker running without consent.

What we saw when we tested on a real WordPress site

On 8 November 2026 we built a test site on WordPress 7.1.4 with the Twenty Twenty-Five theme. We pasted a Google Analytics 4 tag and a Meta pixel into the header, the way most people add them, and put a YouTube video on the homepage. Then we visited it as a first-time visitor in a fresh Chromium browser and recorded every request and cookie.

With no consent tool, all three loaded on the first visit and set their cookies, including _ga and YouTube's cookies.

Next we tried several popular free consent plugins straight after activating them, before running their setup. In that state none of them held the trackers back. That is expected, because each one asks you to finish a setup first, such as a cookie scan, a wizard or connecting an account, and we did not configure other vendors' tools for this test. The lesson is simple. Installing a consent plugin is not the same as blocking. Finish the setup, then run the test above.

Then we ran WPCentrify's banner with the settings our dashboard uses by default:

Test results for WPCentrify cookie consent on a WordPress site: Google Analytics, Meta pixel and YouTube held before a choice and after Reject all, loaded only after Accept all
Our test site, 8 November 2026. Google Analytics and the Meta pixel were pasted into the header; YouTube was embedded on the page.
WPCentrify cookie consent test results
Visitor actionGoogle AnalyticsMeta pixelYouTube embedCookies set
Page opened, no clickHeldHeldHeldNone
Clicked Reject allHeldHeldHeldOnly the choice cookie (wpc_consent)
Clicked Accept allLoadedLoadedLoaded_ga, _ga_*, Meta and YouTube cookies

This is one test on one site, run by us on our own product, so treat it as an example of the method rather than a ranking. You can repeat the same test on your site in five minutes.

Why does a cookie banner show but not block?

When a banner appears but trackers still load, it is usually one of these:

Why a cookie banner shows but does not block
CauseWhat is happeningFix
Setup not finishedThe tool has not scanned the site or blocking is switched offFinish the scan or wizard and switch blocking on
Code pasted into the headerThe tracker is inline code with no file address, so a tool that matches script addresses misses itUse a tool that recognizes inline code, or move the tag into the tool's own tag settings
A tag manager fires the tagsGoogle Tag Manager loads the tracker after the page is builtAdd consent conditions in Tag Manager, or use Consent Mode with blocking
A cached pageYour caching plugin or CDN still serves the page from before the bannerEmpty every cache, then test again
A speed plugin delays scriptsDelay or combine JavaScript settings change the order scripts run in, so the banner loads after the trackersExclude the consent script from delay and combine settings
Two consent toolsAn old plugin and a new one both run, and they disagreeKeep one consent tool active, never two
A plugin sets cookies itselfSome plugins set cookies on the server, before any banner script runsCheck the plugin's settings for a consent option, or replace it

Speed plugins matter here because the banner must load first. If you also want a faster site, our guide to improving Core Web Vitals on WordPress covers delaying scripts safely.

Google Consent Mode lets your banner tell Google tags whether the visitor said yes. Since March 2024 Google has required consent signals from EEA visitors for its ad personalization and measurement features. Google describes two modes in its Consent Mode help page:

Google Consent Mode basic vs advanced
Basic modeAdvanced mode
Before the visitor choosesGoogle tags do not loadGoogle tags load and wait
If the visitor rejectsNo data goes to Google, not even the consent statusTags send cookieless pings
Data for Google's modelingLessMore
Good forA cautious setupSites that have decided cookieless pings are acceptable

Consent Mode is a signal to Google only. It does not block trackers from Meta, Microsoft, TikTok or anyone else, so you still need a banner that holds those back.

Do you have to honor Global Privacy Control?

Global Privacy Control (GPC) is a browser setting that tells websites the person does not want their data sold or shared. Under the California regulations, a business that sells or shares personal information must treat a valid signal like GPC as an opt-out request. In 2022 California's Attorney General settled with Sephora for $1.2 million, partly for not processing GPC opt-outs. If you have California visitors, choose a tool that respects GPC automatically.

What records of consent should you keep?

Keep enough to show what someone agreed to and when. A useful record holds the time, the choices made, which version of the banner and policy was showing, and a shortened IP address rather than the full one. There is no single legal retention period for every case, so keep records at least as long as you rely on the consent and agree the exact period with whoever handles your privacy compliance.

Do you need to ask again when your banner or trackers change?

Yes, when you add new trackers or change what visitors are agreeing to. An earlier yes was given to a different question. Most consent tools can ask returning visitors again when you change the policy version.

What happens to cookies set before a visitor said no?

Blocking stops new cookies being set. It does not remove cookies already on the device from before the banner was installed or from an earlier yes. A good tool deletes your site's own tracker cookies when a visitor rejects. No script can delete another company's cookies, such as those set on facebook.com or youtube.com, because browsers do not allow it.

What do free cookie consent plans really include?

Free plans differ a lot, and some stop showing the banner when you pass a limit. These are each vendor's own published terms, checked on 8 November 2026:

Free cookie consent plan limits for WordPress, checked 8 November 2026
ToolFree plan, as the vendor states itWhen the limit is reached, per the vendor
CookieYes5,000 pageviews a month (websites on the free plan before 1 July 2025 keep 15,000), one free plan per accountThe banner stops showing until the count resets next month or you upgrade
WPLP Cookie Consent1 site, 20,000 banner pageviews a monthThe banner stops showing until the next month starts
iubenda5,000 pageviews a monthThe banner is deactivated for the month
Termly10,000 banner views a monthThe banner is deactivated until the following month
Cookie Compliance (Hu-manity)1,000 visits per 30 days when connected to a free accountAutomatic blocking and consent records stop until the next cycle
ComplianzFree plugin with no pageview limits; the wizard scan covers up to 50 postsNo pageview limit stated
WPConsentFree plugin with no pageview capsNo pageview limit stated
Cookiebot1 domain with up to 50 subpagesLarger sites need a paid plan sized to their page count

Prices and limits change. Check each vendor's page before you choose, and tell us if anything here is out of date.

Do you need a cookie policy and a privacy policy too?

Yes, in most cases. The banner should link to a cookie policy that lists what the site uses, and to a privacy policy that explains what you do with personal data. WordPress has a built-in privacy policy helper under Settings, Privacy, which creates a draft page with suggested text. Many consent tools also generate a cookie policy. Generated text is a starting point, not legal advice, so have it reviewed.

How do you manage cookie consent across many WordPress sites?

Doing it site by site means one plugin, one setup and one set of records per site, and the settings drift apart over time. Our story of fixing cookie consent on 30+ client sites shows how that goes wrong.

WPCentrify, the WordPress management tool we build, runs WordPress cookie consent on every site you connect, from one dashboard. Here is what it does, in plain terms:

  • Holds analytics, advertising and embed trackers until the visitor chooses, including code pasted into the theme header, as the test above shows.
  • Shows Reject all beside Accept all with the same weight, a panel to choose by category, and a small button on every page to change the choice later.
  • Sends Google Consent Mode v2 signals, in basic mode unless you choose advanced for a site.
  • Respects Global Privacy Control.
  • Records each answer with the banner wording and policy version that were showing.
  • Lists the third parties each site loads, so you can decide what each one is.
  • Writes the privacy policy, cookie policy and terms of use pages from templates, without overwriting a page you already have unless you choose to.
  • Stands down if another consent plugin is active, so a site never shows two banners.
WPCentrify cookie preferences panel on a WordPress site with Strictly necessary always on and Functional, Analytics and Marketing switched off until the visitor chooses
The preferences panel on our test site. Every category except strictly necessary starts switched off.

What it is not: WPCentrify is not a Google-certified CMP and does not support the IAB Transparency and Consent Framework. Google requires a certified CMP for AdSense, Ad Manager and AdMob publishers serving personalized ads in the EEA, UK and Switzerland, so a site in that position should use a certified tool. Cookie consent is included on the Agency and Scale plans and is a $15 a month add-on on Solo and Studio. See pricing for details.

Switching from another consent tool?

If you are moving away from a tool you already use, our comparisons cover what to check first: CookieYes alternatives, Complianz alternatives and WP Legal Pages alternatives.

Sources

All checked 8 November 2026: ePrivacy Directive; GDPR; Planet49 judgment; ICO consent guidance; EDPB cookie banner report; CNIL; Google Consent Mode; Google certified CMPs; California CCPA regulations; WordPress cookies; and each vendor's pricing or plugin page linked in the free plans table.

Answers

Questions about WordPress cookie consent banners

You need one if the site sets cookies or loads trackers that are not strictly necessary, such as Google Analytics, advertising pixels or YouTube embeds, and people in the EU, UK or another place with consent rules visit it. A site that sets only strictly necessary cookies may not need one. This is general information, not legal advice.

Yes, but mostly for logged-in users and commenters. WordPress sets login cookies for people who sign in, and commenter cookies only when a commenter ticks the box to save their details, which WordPress has asked for since version 4.9.6. Most tracking cookies on a WordPress site come from plugins, themes, embeds and code added to the header.

Open the site in a private window, open DevTools, and look at the Application tab for cookies and the Network tab for requests before you click anything. If you see cookies like _ga, _fbp or _gcl_au, or requests to google-analytics.com or facebook.com, before you accept, the banner is not blocking them.

Under the EU ePrivacy rules and the UK rules, non-essential cookies need consent before they are set. A banner that shows a message while trackers load anyway does not ask first, so it does not meet that rule.

A cookie notice tells visitors that the site uses cookies. Cookie consent asks first and waits for the answer, holding non-essential cookies and trackers back until the visitor accepts them.

No. Consent Mode tells Google tags what they may do. It does not block trackers from other companies such as Meta, Microsoft Clarity or Hotjar, so you still need a banner that holds those back.

In basic mode Google tags do not load until the visitor chooses. In advanced mode Google tags load straight away and send cookieless pings while consent is denied. Basic is the cautious choice; advanced gives Google more data for modeling. Decide with whoever is responsible for your privacy compliance.

Because visitors who reject or ignore the banner are no longer measured with cookies. That is the banner working. Google Analytics can model some of that traffic when Consent Mode is set up, but the raw numbers will be lower than before.

In California, businesses that sell or share personal information must treat a valid opt-out preference signal such as Global Privacy Control as a request to opt out. Many consent tools can respect GPC automatically. Check whether your tool does and whether the law applies to you.

They can close it, but closing it should not count as consent. Until a visitor accepts, non-essential cookies should stay blocked.

If you add new trackers or change what visitors are agreeing to, ask again. Their earlier answer was given to a different question. Many tools let you renew consent when the policy version changes.

A well-built banner adds one small script and some styling. Problems usually come from heavy vendor lists, banners that load late, or a banner fighting with a speed plugin. Test your PageSpeed score before and after.

Early access

Run cookie consent on every site from one dashboard

Hold trackers until visitors choose, keep a record of every answer, and see what each site loads, without a plugin to set up on every install.

Included on Agency and Scale. A $15 a month add-on on Solo and Studio.