Blog

How to Add Cookie Consent Banner in WordPress

There are a lot of articles on the Internet that will tell you that you need to install a plug-in in order to have a cookie banner displayed on your WordPress website.

While using a plug-in is an option, it is not necessary and could slow down your website which could affect user experience and SEO.

We will go over another technique that will allow you to simply copy and paste a few lines of code into your WordPress site, no coding or web development skills required.

We will first demonstrate how to use our cookie consent banner generator to customize and generate a cookie pop-up for your WordPress website.

Start by selecting the style of your cookie banner, you have the choice between a tooltip or a bar, and where you would like it to be displayed:

Cookie banner's style

Once you have chosen the style and where it will be displayed, you can customize the banner so that it fits with your website aesthetic:

Cookie banner's layout, it shows the style of the banner that you customize.

You can choose from the suggested color palettes or use the exact hex color codes that you use on your website.

Cookie banner's color scheme.

You will then copy and paste the URL to your cookie policy so that it is easily accessible for your website users. If you don’t have a cookie policy (and you should), you can use our free generator to create one in just a few minutes.

Cookie banner insert URL section

Here, you can choose to use the default text or insert your own to make sure that it matches the tone of voice used on your website:

Cookie banner's customize text displayed on the cookie banner.

Last but not least, copy the code generated in the box, which you will then simply paste into your WordPress website, as per the instructions below:

Cookie banner's HTML code to be copied and placed onto the user's website

Note: you can use the button “Click to preview” to see what your banner is going to look like before adding it to your website.

Now that you have the code that will display your custom cookie consent banner on your website, navigate to WordPress and log in as you usually would.

When in your WordPress Dashboard, click on the “Appearance” tab in the left-hand menu and select “Theme Editor”:

Adding a cookie consent banner to WordPress without a Plug-in

You will land on your website’s stylesheet. Find the </head> tag or, on the right side of the screen, under “Theme Files” click on “Theme Header”:

Wordpress' cookie banner color scheme

Once you have found the code related to the header of your website, paste the code that was generated earlier through our cookie consent banner generator just above the </head> tag:

Cookie banner HTML code

The code highlighted in blue is what was generated by our cookie consent banner generator.

Click on the blue button “Update File” to save your changes:

Cookie consent banner's HTML code

That’s it - no need to install any plug-ins or write any code yourself, as long as you are able to log in to your WordPress account and copy and paste a few lines of code, you are good to go.

Here is what your website will look like once you have added the code to the header of your website (using the default settings and without any customization):

Example of the cookie consent banner on the WordPress website

By clicking on “Learn more” your website visitors will be redirected to the page on your website where your full cookie policy is displayed so that they can review the information that you are collecting and manage their cookie preferences.

By clicking on “Got it!” they are consenting to the use of cookies as set out in your cookie policy and the banner will subsequently disappear.

Cookie compliance should not be taken lightly. Privacy and security concerns are on the rise as people become increasingly aware of the personal information that they share and the traces that they leave on the Internet.

Not to mention the ever-changing privacy laws, such as the GDPR and the upcoming ePrivacy Regulation, which notably strive to strike a balance between individual rights to data protection and privacy, freedom of expression and information, and legitimate interests of businesses for processing personal data.

Not complying with applicable legislation and not informing your website visitors that you are using cookies could have serious consequences.

To make it easier to stay on top of your obligations as a website owner and data processor, we have created both a cookie policy generator as well as a cookie consent tool, which we used in this article.

It only takes a few minutes to become GDPR-compliant and it could save you a lot of trouble down the road.