WordPress Integration

WordPress Cookie Banner
No Plugin Required

Most WordPress cookie plugins add 200+ KB and slow every page load. Ours is 1 script tag, under 10 KB, and takes 5 minutes to install.

Under 10 KBGDPR + PIPEDA + CCPA$99 one-time

Why Does Your WordPress Site Need a Cookie Banner?

If your site runs Google Analytics, WooCommerce, Facebook Pixel, or any ad network, it sets cookies. Privacy laws require you to ask first.

Plugin bloat is real

The average WordPress cookie plugin adds 150-300 KB of JavaScript, extra database queries, and admin-side overhead. Your visitors pay the performance tax on every page load.

GDPR fines are not theoretical

Regulators issued over 2 billion euros in GDPR fines in 2024 alone. If your WordPress site sets cookies before getting consent, you are non-compliant. Full stop.

Plugin conflicts break sites

Cookie plugins hook into wp_head, modify headers, and conflict with caching layers. When two plugins fight over the same hook, your visitors see a broken site.

Configuration takes hours

Most cookie plugins have 30+ settings screens, script-scanning tools, and auto-categorization that never quite works. You end up manually tagging every script anyway.

How to Add a Cookie Banner to WordPress

Three approaches, same result. Pick the one that matches your comfort level with WordPress.

01

Use WPCode Plugin

Recommended

The easiest way. Install a free plugin, paste your script, done. No file editing, no coding.

  1. In WordPress, go to Plugins → Add New and search for "WPCode"
  2. Install and activate it
  3. Go to Code Snippets → Header & Footer
  4. Paste your banner script into the "Header" section:
<!-- Paste into the "Header" field in WPCode -->
<script src="https://www.cookie-banner.ca/api/v1/banner.js?id=YOUR_BANNER_ID" async></script>

Replace YOUR_BANNER_ID with the ID from your dashboard's Code tab. Then click Save Changes.

  • No code editing required
  • Survives theme switches and updates
  • Works with every WordPress theme
  • Takes under 2 minutes
02

Full Site Editor (Block Themes)

No Plugins Needed

Using a block theme like Twenty Twenty-Four? No plugin needed — just add a Custom HTML block.

  1. Go to Appearance → Editor
  2. Select Template Parts → Header
  3. Add a Custom HTML block
  4. Paste your banner script:
<script src="https://www.cookie-banner.ca/api/v1/banner.js?id=YOUR_BANNER_ID" async></script>
  • Native WordPress, no plugins
  • Only works with block-based themes
03

Add to functions.php

Developers Only

For developers who prefer no plugins. Add to your child theme's functions.php.

// Add to your child theme's functions.php
function add_cookie_banner_script() {
    echo '<script src="https://www.cookie-banner.ca/api/v1/banner.js?id=YOUR_BANNER_ID" async></script>';
}
add_action('wp_head', 'add_cookie_banner_script');
  • Zero plugin overhead
  • Must use a child theme — parent updates will overwrite

Banner not showing? Check your Content Security Policy

If your WordPress site has a security plugin (Sucuri, Wordfence, Headers Security, etc.) that sets a Content Security Policy (CSP), you may need to whitelist our domain. Add these to your CSP:

script-src: https://www.cookie-banner.ca
connect-src: https://www.cookie-banner.ca
style-src: https://fonts.googleapis.com

How to check: Open your browser's DevTools (F12) → Console tab. If you see a message like Refused to load the script... violates Content Security Policy, this is the issue. Contact your hosting provider or check your security plugin's CSP settings.

Does It Work with My WordPress Theme?

Yes. A script tag works with every WordPress theme because it runs in the browser, not in PHP. Here are the themes our users run most often.

Astra

Lightweight and fast

GeneratePress

Performance-focused

Divi

Visual page builder

OceanWP

WooCommerce-ready

Storefront

Official WooCommerce theme

Newspaper

Magazine and news

Elementor Hello

Minimal starter theme

Twenty Twenty-Four

Default block theme

Works with every WordPress theme. If it runs on WordPress, it works with our banner.

How Does This Compare to WordPress Cookie Plugins?

Side-by-side with the most popular WordPress GDPR cookie plugins.

Cookie BannerCookieYesComplianz
Script sizeUnder 10 KB~180 KB~220 KB
Database tables03+5+
Admin UI overheadNoneFull dashboardWizard + settings
GDPR + PIPEDA + CCPAYesYesYes
Pricing$99 one-time$99/yr$45/yr
Cache-friendlyAlwaysVariesVaries

WordPress Cookie Banner FAQ

Common questions about adding cookie consent to WordPress without a plugin.

5-minute setup, no plugin needed

Stop Overpaying for Cookie Compliance

One script tag. Under 10 KB. Works with every WordPress theme, caching plugin, and CDN. Build your banner in the visual editor and paste it into your site.