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.
Table of contents
Generate a Cookie Consent Banner
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:
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:
You can choose from the suggested color palettes or use the exact hex color codes that you use on your website.
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:
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:
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.
Add a Cookie Consent Banner to WordPress Without a Plugin
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”:
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”:
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:
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:
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):
Make Your WordPress Website Cookie-Compliant
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.
It only takes a few minutes to become GDPR-compliant and it could save you a lot of trouble down the road.
- Updated on February 18, 2021