This tutorial provides the steps to display a fixed cookie consent bar that can be dismissed by your site visitors at the bottom of your site.

Step 1

Go to, configure the cookie consent bar to your liking and you should see the generated code.

In this example, we shall go with the default one.

Step 2

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: Cookie Consent


add_action( 'wp_head', 'custom_cookie_consent' );
 * Add Cookie Consent bar.
 * @link Code generated from here.
function custom_cookie_consent() { ?>

    <link rel="stylesheet" type="text/css" href="//" />
    <script src="//"></script>
    window.addEventListener("load", function(){
      "palette": {
        "popup": {
          "background": "#000"
        "button": {
          "background": "#f1d600"

<?php }

Replace the code above in between function custom_cookie_consent() { ?> and <?php } with the code generated in the earlier step.

Set it to run only on the front-end.

Save and activate.

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: