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.
Table of Contents
- What you’ll need
- Step 1 — Generating the Cookie Notice Code
- Step 2 — Putting the Code in WordPress
- Step 3 — Testing the Cookie Notice
What you’ll need
Before you begin this guide you’ll need the following:
- Access to WordPress Admin Area
Step 1 — Generating the Cookie Notice Code
Visit WebsitePolicies 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.
Here is another campany you can use to display Cookies pop up notice, without installing plugin: