WordPress Tutorial

How to Display Cookie Notice on WordPress Without any Plugins

Introduction

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:

Looking for a better way to host your website?

Transfer your website to the fastest web hosting platform with 24/7 dedicated support.

Testing Cookie Notice

Conclusion

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.

Add Comment

Click here to post a comment

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

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

Close