← All articles
How-to Guides2 December 2025·4 min read

How to Add a Cookie Consent Banner to WordPress

A step-by-step guide to adding a GDPR-compliant cookie consent banner to your WordPress website — without slowing your site down or conflicting with other plugins.

WordPress is the most popular CMS in the world, but adding a cookie consent banner to it can be surprisingly frustrating. Many dedicated cookie plugins are bloated, conflict with caching plugins, or slow down your page speed scores. Here's a simpler approach.

Option 1: Use a dedicated cookie plugin

There are several WordPress plugins designed specifically for cookie consent: CookieYes, Complianz, and GDPR Cookie Consent are among the most popular. The downside is they add database queries, scripts, and admin overhead to your WordPress install. They can conflict with caching plugins like WP Rocket, and some have had security vulnerabilities in the past. If you go this route, make sure the plugin receives regular updates and has a strong track record.

Option 2: Use a lightweight script (recommended)

A faster, cleaner approach is to use a standalone consent script that you add to your WordPress site via the header. MyCookieKit works this way — you install a single lightweight JavaScript snippet once, and it handles everything: banner display, consent collection, script blocking, Google Consent Mode v2, and geo-targeting. No WordPress plugin required, no database overhead, no conflicts.

How to install MyCookieKit on WordPress

There are two ways. First, you can use our WordPress plugin — download it from your MyCookieKit dashboard and upload it via Plugins → Add New → Upload Plugin. It automatically inserts the script in the right place. Second, you can add the script manually: go to Appearance → Theme File Editor → header.php and paste your embed code just before the closing </head> tag. If you're using a page builder like Elementor or Divi, most have a "Custom Code" or "Header Scripts" section in their settings.

Will it slow my WordPress site down?

No. The MyCookieKit script is under 10KB, loads asynchronously, and is served from a fast CDN. It won't affect your Core Web Vitals or Lighthouse scores. Many of the dedicated WordPress cookie plugins add far more weight because they also load their own CSS, admin assets, and database queries on every page.

What about WooCommerce?

WooCommerce sites need to be particularly careful because they use cookies for cart and checkout functionality (which are necessary cookies) alongside marketing and analytics cookies. MyCookieKit handles this correctly: necessary cookies are never blocked, while non-essential cookies (like Facebook Pixel or Google Ads) are blocked until consent is given. This ensures your checkout flow is never disrupted.

Testing your setup

After installation, open your site in an incognito browser window. Your cookie banner should appear. Try clicking "Decline" and verify in the browser developer tools (Application → Cookies) that no analytics or marketing cookies have been set. Then accept all cookies and confirm they appear. This is the fastest way to check your consent flow is working correctly.

Get a GDPR-compliant cookie banner in 2 minutes

MyCookieKit handles consent, script blocking, and Google Consent Mode v2. From £2.99/month with a 14-day free trial.

Start free trial →

More articles

GDPR Basics

Cookie Banner vs Privacy Policy: What's the Difference?

Compliance

GDPR Fines for Cookie Violations: What Small Businesses Need to Know

Comparisons

The Best Cookiebot Alternative for Small Businesses in 2025