Cookie Banner for WordPress
WordPress powers over 40% of the web, and if you're using analytics, contact forms, or any marketing tools, you need a cookie consent banner. While there are many WordPress cookie plugins, they often slow down your site and conflict with caching. TinyConsent offers a cleaner solution: one line of code that works with any WordPress setup.
Get Your WordPress Code
No signup required to get started
Live Banner Preview
This is how the cookie banner will appear on your WordPress site.
My WordPress Site uses cookies to enhance your experience and analyze traffic. By clicking "Accept", you consent to our use of cookies.
WordPress Integration Code
Add this to: header.php or functions.php
<!-- Add this to your WordPress header.php before </head> -->
<!-- Or use "Insert Headers and Footers" plugin -->
<?php
// Option 1: Direct in header.php
?>
<script src="https://scripts.tinyconsent.com/api/scripts/YOUR_SCRIPT_ID" async></script>
</head>
<?php
// Option 2: Using wp_head hook in functions.php
function add_tinyconsent_script() {
echo '<script src="https://scripts.tinyconsent.com/api/scripts/YOUR_SCRIPT_ID" async></script>';
}
add_action('wp_head', 'add_tinyconsent_script', 1);
?>Replace YOUR_SCRIPT_ID with your actual script ID from TinyConsent.
Why WordPress Sites Need a Cookie Banner
Most WordPress sites use plugins like Google Analytics, Jetpack, WooCommerce, or social sharing buttons — all of which set cookies that require consent under GDPR. Even basic WordPress installations may set session cookies that need disclosure.
What TinyConsent Handles for WordPress
- Automatic blocking of tracking scripts until consent
- Technical consent collection with region detection
- Google Consent Mode v2 integration
- Consent storage and audit logging
- Customizable design to match your site
How to Add a Cookie Banner to WordPress
Generate your script
Visit tinyconsent.com and enter your email to get your unique script tag.
Access WordPress admin
Log into your WordPress dashboard and go to Appearance → Theme Editor (or use a header/footer plugin).
Edit header.php
Find your theme's header.php file, or use a plugin like "Insert Headers and Footers".
Paste the script
Add the TinyConsent script just before the closing </head> tag.
Save and test
Save changes and visit your site in an incognito window to see the banner.
Customize (optional)
Log into your TinyConsent dashboard to adjust colors and text to match your theme.
WordPress Tips
- •Works with all WordPress themes including block themes
- •Compatible with caching plugins like WP Rocket and W3 Total Cache
- •No plugin conflicts — runs independently of WordPress
- •Doesn't add database queries or slow down your site
Why TinyConsent for WordPress
60-Second Setup
No npm packages, no build configuration. Just one script tag and you're compliant.
Lightweight
Under 5KB initial load. Zero impact on your WordPress bundle size.
Technical Infrastructure
Script blocking, consent logging, and region detection. Technical foundation for consent workflows.
Developer-Friendly
JavaScript API for checking consent status. Perfect for conditional script loading.
Frequently Asked Questions
Do I need a WordPress cookie plugin?
No. TinyConsent works without any plugin. Just add one script tag. This avoids plugin bloat and potential conflicts.
Will this work with my caching plugin?
Yes. TinyConsent loads from our CDN, so it works perfectly with WP Rocket, W3 Total Cache, LiteSpeed, and other caching solutions.
Does it work with WooCommerce?
Yes. TinyConsent detects and manages cookies from WooCommerce and its payment gateways, ensuring proper consent collection.
What about Elementor/Divi/other builders?
TinyConsent works with all page builders. Add the script to your theme's header or use a header scripts plugin.
Can I use this with WordPress Multisite?
Yes. Each site in your multisite network can have its own TinyConsent script, or share one across the network.
Is this better than GDPR Cookie Consent plugin?
TinyConsent is lighter (no database queries), faster (CDN-hosted), and includes privacy policy generation — which most plugins charge extra for.