Getting Started

How to Add a Cookie Banner to WordPress

To add a cookie banner to your WordPress website, first create and customise your banner in CookieYes. You can then copy the installation code and add it to your website using the WordPress theme editor or a header and footer plugin.

This guide explains both installation methods and shows you how to verify that your cookie banner is active.

Before you begin:

Note

To install the banner using the CookieYes WordPress plugin instead, see
How to Install CookieYes WordPress Plugin

If you have already signed up for CookieYes without completing the initial setup, go to the CookieYes Dashboard

  • To customise your cookie banner, select Cookie Banner from the top navigation panel.
  • To get the banner installation code, go to Advanced Settings and click Get Installation Code next to your website URL.
  • Click Copy code to copy the CookieYes installation code.
Note

You can share the code with a developer or team member by clicking Send code to a teammate. Enter their email address and click Send email. They will receive the code and installation instructions by email.

You can also follow the step-by-step instructions below to add the CookieYes cookie banner to your WordPress website.

There are two ways to add the CookieYes installation code to WordPress:

  • Using the WordPress theme editor: Paste the CookieYes code directly into your theme’s header file.
  • Using a header and footer plugin: Use a plugin to add the code to your website header without editing your theme files.

Add the installation code using the theme editor

Step 1. Go to your WordPress Dashboard and select Appearance > Theme File Editor.

Step 2. In the theme editor, open Theme Header and paste the CookieYes code between the <head> and </head> tags, before any other scripts.

Note:

If you add the CookieYes installation code after other custom scripts, the auto-blocking function may not work as intended.

Step 3. Click Update File to save your changes. Visit your website to check whether the cookie banner is active.

Step 4. Return to the CookieYes setup screen and click Verify. You will see a success message when the banner is active.

Note

You may need to add the CookieYes installation code again whenever you update or change your WordPress theme.

Your cookie consent banner should now be live on your WordPress website. Alternatively, you can use a plugin to add the installation code.

Add the installation code using a plugin

You can use a header and footer plugin to insert the CookieYes installation code without editing your WordPress theme files.

Tip:

With this method, you will not normally need to add the CookieYes code again when you update or change your website’s theme.

Step 1. Download and install a header and footer plugin of your choice on your WordPress website.

Step 2. Paste the CookieYes code into the plugin’s Header section and save your changes. Visit your website to check whether the banner is active.

Step 3. Return to the CookieYes setup screen and click Verify. You will see a success message when the banner is active.

Your cookie consent banner should now be live on your WordPress website. You can return to the CookieYes Dashboard to complete your website scan and explore additional customisation options and features.

Still have questions or facing issues? Contact technical support

Was this article helpful?