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.
Table of Contents
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:
Optionally, you can Customize the text of the pop-up. Click Continue once done.
Finally, copy the generated code:
Step 2 — Putting the Code in WordPress
Log in to your WordPress Admin Area and navigate to Appearance –> Editor:
Open up the
header.php file and paste the code you have copied after the opening
Click on Update File to save:
Step 3 — Testing the Cookie Notice
Visit your website and you will see the cookie notice being displayed:
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.