Zimt

How to Add a Cookie Consent Banner to WordPress

· 5 min read · Cookies and Bars

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Adding a cookie consent banner to WordPress ensures your site complies with privacy regulations like GDPR and CCPA by letting visitors choose whether to allow cookies. This guide shows you how to add one using a free plugin, with no coding required.

What You'll Need

  • A self-hosted WordPress site (wordpress.org) – not WordPress.com free plan, which restricts plugins.
  • Admin access to your WordPress dashboard.
  • An idea of which cookies your site uses (e.g., analytics, advertising) – you can list them later.

Step-by-Step

  1. Log in to your WordPress admin panel. Go to yourdomain.com/wp-admin and enter your credentials.
  2. Navigate to Plugins → Add New. In the left sidebar, click “Plugins” then “Add New”.
  3. Search for a cookie consent plugin. In the search box, type “cookie consent” or “GDPR”. Popular free options include Cookie Notice & Compliance for GDPR/CCPA or Complianz. For this guide, we’ll use Cookie Notice & Compliance – it’s lightweight and widely used.
  4. Install and activate the plugin. Click “Install Now” next to the plugin, then “Activate”.
  5. Go to the plugin’s settings. After activation, you’ll see a new menu item like “Cookie Notice” in the left sidebar. Click it to open the settings page.
  6. Configure the banner message. In the “General” tab, you can edit the message text that appears on the banner. The default is fine, but you can customize it to match your site’s tone.
  7. Set button labels. Change the text for “Accept” and “Decline” buttons if you wish. For example, “I Agree” and “No, Thanks”.
  8. Choose the banner position and style. Select where the banner appears – typically at the top or bottom of the screen. You can also adjust the background color and text color to match your theme.
  9. Enable cookie rejection behavior. In the “Options” section, check the box that says “Set cookies to be rejected by default” or similar. This ensures that if a visitor clicks “Decline”, no non-essential cookies are set.
  10. Add a link to your privacy policy. Look for a field like “Privacy Policy URL” or “Cookie Policy URL”. Enter the URL of your privacy policy page. If you don’t have one, create a simple page first (Pages → Add New) and publish it.
  11. Save your changes. Click “Save Changes” at the bottom of the settings page.
  12. Test the banner. Open your site in a new incognito window (to clear existing cookies). You should see the banner appear. Click “Accept” and then “Decline” to verify both actions work.

Common Mistakes

  • Not listing cookies accurately. The banner is only part of compliance; you also need to disclose what cookies you use. Many plugins provide a cookie list, but you must review it and add any custom cookies (e.g., from embedded videos).
  • Forgetting to add a privacy policy link. Without a link to your privacy policy, the banner is incomplete and may not meet legal requirements.
  • Placing the banner where it’s easily ignored. A tiny banner at the very bottom might not be noticed. Make sure it’s visible but not intrusive.
  • Not testing on mobile. The banner might look fine on desktop but overlap content on mobile. Always check on a phone.

Tips

  • Use a plugin that blocks scripts until consent. Some plugins only show a notice but don’t actually stop cookies from being set. Look for ones that offer “script blocking” or “cookie blocking” features.
  • Keep the message short. Visitors are more likely to click if the text is concise. “We use cookies to improve your experience” is better than a long paragraph.
  • Set a cookie expiration. Most plugins let you choose when the consent expires (e.g., 30 days). A shorter period means more frequent prompts, which can be annoying; a longer period reduces prompts but may not satisfy some regulations. 30–90 days is common.
  • Use a plugin that supports GDPR and CCPA. If you have visitors from the EU and California, you need to comply with both. Many plugins now handle both.

Troubleshooting

  • Banner doesn’t appear. First, clear your browser cache and cookies. If it still doesn’t show, check that the plugin is activated. Also, some caching plugins may need to be purged.
  • Banner appears but clicking buttons does nothing. This often happens if there’s a JavaScript conflict with your theme or another plugin. Try disabling other plugins one by one to find the culprit. If that’s not possible, switch to a default theme temporarily to test.
  • Banner covers the entire screen. Some plugins have a “full-screen” mode. Check the settings and switch to a simple bar or box.
  • Consent is not remembered. If the banner reappears on every page, the plugin may not be setting a cookie. Check if your site uses a caching plugin that is serving cached pages without the consent cookie. Exclude the consent cookie from caching.
  • Google Analytics still tracks before consent. If you’re using a plugin that doesn’t block scripts, you need to add a script blocker. Some plugins have this built-in; if not, you may need a more advanced plugin like Complianz or a tag manager solution.

Frequently Asked Questions

Is a cookie consent banner legally required?

It depends on your audience. If you have visitors from the EU or UK, GDPR requires consent for non-essential cookies. California’s CCPA has different requirements, but a banner is a good practice. Even if not legally required, transparency builds trust.

Can I add a cookie banner without a plugin?

Yes, you can manually add HTML/JavaScript to your theme’s header or footer, but it’s more complex and error-prone. Plugins are easier and offer compliance features like script blocking.

Will a cookie banner slow down my site?

Most cookie consent plugins are lightweight and have minimal impact. However, some heavy plugins can affect performance. Choose a well-coded plugin and test your site’s speed after installation.

What’s the difference between GDPR and CCPA cookie consent?

GDPR requires opt-in consent (the visitor must actively agree before cookies are set). CCPA allows opt-out (cookies can be set by default, but visitors must be able to opt out). Some plugins support both modes.

How do I list the cookies my site uses?

Check your browser’s developer tools (Network tab) to see cookies set by your site. Also, review any third-party services you use (Google Analytics, Facebook Pixel, etc.) and list them in your cookie policy.

Can I customize the banner to match my brand?

Yes, most plugins allow you to change colors, text, and button styles. Some even let you add custom CSS for full control.