in ,

How to Add a Cookie Consent Bar to WordPress

This time I’m going to explain how you can add a cookie consent bar to your WordPress website or blog. If you use cookies on your WP website (e.g. you have Google Analytics installed or you have some affiliate links) and if you have visitors from the European Union, you are required to give a notice about using cookies to your visitors. It is an EU law requirement.

OK, now let’s mention what I will do. I will install 2 plugins for this: one will take care of displaying the cookie consent bar, and the other one will take care of that the cookie notice bar will show to European visitors only. It is required for the EU only, so why bother your US or Asian visitors with this, too.


Cookie Consent Notice Bar Preview


Also, I’d like to emphasize that this works with any WordPress theme, not just Divi, as these 2 plugins work independently of Divi. And both of these plugins are free.

So the first thing that you need to do is to install the Cookie Consent plugin. Of course there are more cookie consent plugins, but I use particularly this one, because I like its design and I like the feature that it can be set to display for European visitors only (in combination with the second plugin that we will install next).

Now we will install the GeoIP Detection plugin. Then in the settings of this plugin choose the data source “Automatic download & update of Maxmind GeoIP Lite City”. And in the general options at the bottom don’t forget to tick the option “Add a country-specific CSS class to the-Tag.”. This is important, because without this setting it didn’t work for me. So don’t forget to set this up.


GeoIP Detection Plugin Settings


The last thing that we need to do is to setup the Cookie Consent plugin. Go to Settings > Cookie Consent in your WP admin panel and you will be able to setup all the options for this plugin. In its general settings I choose all countries except Europe, in the “Exclude Zones” option. This shall make sure that the consent bar will show for European visitors only. Please note that you will need to have the GeoIP Detection plugin installed as well in order to be able to take the advantage of this feature.


GeoIP Plugin Exclude Zones


After that go to the “Content” settings and here you can write the texts for your consent bar as well as choose the “More Info Page” page. I would set this to your Privacy Policy page on which you should have explained that your website uses cookies. You can also choose the accept text for the button on the bar. I usually use just “OK” for this.


Cookie Consent Plugin Settings


And finally, in the Styles tab, you can customize the design of your cookie consent bar. You can choose the colors here and choose between top bar, bottom bar, top left block, top right block, bottom left block or bottom right block. This is up to you. As for me, I prefer just a typical bottom bar and I use the shades of gray as my colors.

So that’s it. I hope I have helped you with this article to make your website compliant with this EU law. And if you are looking for tips on how to add GDPR consent checkboxes to Divi theme or Bloom optins, check out my previous article on this blog.

Full Stack WordPress Designer and DeveloperDinar M Islam

Full Stack WordPress Designer and Developer

M: 088 019 24239141


 Dinar M Islam on Freelancer.comHire me on

What do you think?

0 points
Upvote Downvote

Written by Dinar M Islam

More than 6+ years experience in web development specially on wordpress design and development. Making website that will sell your target. Writing and sharing knowledge about wordpress development in leisure time.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.





How to create a custom 404 page in Divi by Mark Hendriksen

How to create a custom 404 page in Divi by Mark Hendriksen

How To Create a Divi Child Theme

How To Create a Divi Child Theme