WordPress Tutorial

How to Display Cookie Notice on WordPress Without any Plugins

The Cookie Law is a European Union Directive and requires websites to get consent from visitors about their data. A chance is that your website is visited by visitors from EU and is a subject to cookie law. This tutorial shows you how to implement cookie notice on your WordPress website without using any plugins. We will simply add a piece of code to accomplish that. The general rule for WordPress is to use as little plugins as possible because every additional plugin adds up to loading time of your website.

What you’ll need

Before you begin this guide you’ll need the following:

Step 1 — Generating the Cookie Notice Code

Visit Silktide and select a template
you want to use. Click Continue to proceed:

Selecting theme for cookie notice

In the step 2 you will need to provide a link to your page about Cookie policy:

Providing Cookie notice page

Optionally, you can Customize the text of the pop-up. Click Continue once done.

Finally, copy the generated code:

Copy provided cookie notice code

Step 2 — Putting the Code in WordPress

Log in to your WordPress Admin Area and navigate to Appearance –> Editor:

Edit your theme file

Open up the header.php file and paste the code you have copied after the opening <head> tag:

Paste the code for cookie notice

Click on Update File to save:

Update wordpress file

Step 3 — Testing the Cookie Notice

Visit your website and you will see the cookie notice being displayed:

Testing Cookie Notice


You have learned how to display Cookie Notice on your WordPress website without any plugins. Your website now complies with the Cookie law and you became more comfortable with editing WordPress. There is no need to install a plugin if the same functionality can be achieved by adding a piece of code.

About the author

Gediminas B.

Gediminas was a passionate content writer and SEO geek at Hostinger. He started his journey at customer support and aims to use his gathered knowledge to create the most epic content the world has ever seen. From WordPress to server management, there's no topic he can't cover! He also likes cats.

Add Comment

Click here to post a comment

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

Get Exclusive Content

Join thousands of webmasters who get our free newsletter with tips on how to drive more traffic and revenue to their websites!

Please wait...

Thank you for sign up!

More in WordPress Tutorial
How to Automate WordPress Backups to Dropbox using UpdraftPlus Plugin