Skip to content
GPLWP Guides

How to manage cookie consent on WordPress

Utilities Time About 30–60 minutes 6 steps Updated 21 Oct 2026

UTILITIES
The short answer

WordPress does not provide complete cookie-consent management by itself. You must identify the cookies your site uses, keep necessary cookies running, block analytics and marketing services until consent, and provide a way to change the choice later. A consent plugin is usually safer for a live site.

The route
  1. 01Audit your cookies and services
  2. 02Keep necessary cookies running
  3. 03Build the manual consent flow
  4. 04Control scripts and embeds
  5. 05Publish the supporting policy
  6. 06Test consent with caching enabled

What you need

  • Administrator access to WordPress
  • A list of analytics, advertising, video, map and marketing services used on the site
  • Access to your caching or optimisation settings
  • A privacy or cookie policy page

Audit your cookies and services

List every service that can set or read cookies, including analytics, advertising pixels, embedded videos, maps, chat widgets, reCAPTCHA and social feeds. Check the browser’s developer tools before consent and after accepting each category.

Classify cookies as necessary, preferences, statistics or marketing. Do not assume that a plugin is necessary just because it runs on your WordPress site. A third-party widget can create non-essential cookies even when the WordPress plugin itself is functional.

Keep necessary cookies running

Allow only cookies that are genuinely needed for functions such as login, shopping carts, security or storing the consent choice. Explain these cookies in your policy rather than offering a blanket approval for every cookie.

Rules differ by country and region, so check the requirements that apply to your visitors. For example, ICO guidance says non-essential cookies should not be set before a clear positive consent action, and users should be able to enable or disable them easily.

Build the manual consent flow

Without a plugin, create a banner or dialog that offers clear choices, records the visitor’s decision, and provides a settings link for changing it later. Your code must prevent non-essential scripts and embeds from loading until the relevant category is accepted, then load them only after the choice is updated.

For Google tags, set the default consent state before the tags run and update it when the visitor chooses. Google’s consent mode does not create a banner itself; it receives consent signals from your banner and changes tag behaviour accordingly.

The drawback is maintenance. You must keep the cookie inventory accurate, handle regional rules, block newly added services, remove cookies after withdrawal where appropriate, and make sure the code works with every theme, plugin and cache layer.

Control scripts and embeds

Do not paste analytics or advertising code directly into the header and expect the banner to control it. Add those services through a consent-aware integration, or place the scripts and iframe sources behind your own consent check. A script hard-coded in the theme, inserted by another plugin, or loaded through an external tag manager can bypass the banner.

Google Tag Manager has a Consent Initialization trigger intended to set consent before other tags fire. Use the correct consent settings for analytics, advertising and user-data processing, then publish the container.

Publish the supporting policy

Add a clearly labelled cookie policy or cookie section to your privacy page. Describe the cookie or service, its purpose, provider, category, duration where known, and how visitors can withdraw consent. Link to the policy from the banner and keep the preference centre accessible after the banner is dismissed.

A privacy policy hidden behind a difficult-to-find link is not a substitute for consent. The banner must explain the choice at the point where it is made.

Test consent with caching enabled

Use a fresh private-browsing window and test the site before accepting anything. Confirm that non-essential cookies are absent, analytics and advertising requests are blocked, and embedded services do not load early. Accept one category at a time, reload several pages, then withdraw consent and repeat the checks.

Clear both browser and site caches after changing banner settings. Page caching, JavaScript delay, minification and server-side rendering can make the banner reappear, disappear or show another visitor’s state. Support reports repeatedly identify cache variation and delayed consent scripts as causes of these failures.

For most live sites, the fast way is to use Complianz Privacy Suite GDPR CCPA Pro. Its wizard, cookie scans, consent banner, policy generation, regional settings and integrations reduce the amount of custom blocking code you need to maintain. It still needs checking: the plugin documentation warns that hard-coded scripts, unsupported services and optimisation plugins can require manual configuration, and a scan alone does not prove that cookies are blocked before consent.

The fast route

Let Complianz Privacy Suite GDPR CCPA Pro do it

Automates consent banners, cookie scans, policy generation, and regional rules; choose it for broad GDPR and CCPA coverage.

Get Complianz Privacy Suite GDPR CCPA Pro

Sources

  1. ico.org.uk /for-organisations/direct-marketing-and-privacy-and-electron…
  2. support.google.com /analytics/answer/10000067?hl=en-4&utm_source=openai
  3. support.google.com /analytics/answer/10718549?hl=en&utm_source=openai
  4. wordpress.org /support/topic/cookie-consent-block-and-caching/?utm_source=…
  5. complianz.io /help/wordpress/faq/blocking-cookies-from-third-party-servic…
  6. complianz.io /help/wordpress/instructions/how-to-identify-cookies-install…

Questions

Does WordPress include a cookie-consent banner?
No, WordPress does not include a complete cookie-consent system that inventories cookies, blocks third-party services and records category choices. You can build those parts yourself with a banner, JavaScript and careful script control, but most sites use a consent-management plugin because the manual approach needs ongoing maintenance and testing.
Can I manage cookie consent without a plugin?
Yes, but you must do more than display a notice. You need to identify every non-essential cookie, prevent its script or embed from loading before consent, store the visitor’s choice, support withdrawal, update the policy and test regional behaviour. A manually added banner is not sufficient if analytics or advertising code still runs in the page source.
Why do cookies appear before visitors accept the banner?
Cookies usually appear early because a theme, plugin, tag manager, inline script or embedded service loads before the consent code blocks it. Caching and JavaScript optimisation can also reorder or delay the banner. Test in a clean private window, inspect requests and cookies, and temporarily disable script delay or combination to identify the conflict.
Does Google Analytics need cookie consent on WordPress?
That depends on your setup and the laws applying to your visitors, but you should not assume that enabling consent mode makes a banner unnecessary. Google says consent mode receives choices from a banner and changes tag behaviour; it does not provide the banner. Configure the default state before Google tags run and verify the update after each choice.
How do I check whether cookie consent works?
Open the site in a fresh private window, do not interact with the banner, and inspect cookies, network requests and third-party domains. Then accept only statistics, reload the page and check what changed. Repeat for marketing, test withdrawal, and repeat with caching and optimisation enabled. A cookie scan helps find services, but it does not by itself prove that they were blocked before consent.