Complianz Privacy Suite

Excluding pages from the Cookie Banner

Aert Hulsebos

Aert Hulsebos

Categories

Popular articles

AMP Integrated with Complianz

From 4.1 onwards, we have integrated with AMP for WordPress. The integration is with the following free AMP plugin https://nl.wordpress.org/plugins/amp/. Another plugin called AMP for

Read More
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Some use cases might be better off by excluding the Cookie Banner or certain pages. These use cases should be considered individually. You can exclude the banner by using a filter in your functions.php, but we would suggest using an MU Plugin.

You will need to exclude your pages by postID, or postID’s.

The Filter

add_filter('cmplz_site_needs_cookiewarning', 'my_filter_site_needs_cookiewarning');
    function my_filter_site_needs_cookiewarning($cookiewarning_required){
        global $post;
if ($post->ID==241441) $cookiewarning_required=false;
return $cookiewarning_required;
}

Finding the postID which corresponds to your page, post any custom post type.

When editing a page or post in, you will find the postID in the domain field of your browser. In this case I’m editing this post with the following URL in my domain field:

https://domain/wp-admin/post.php?post=241441&action=edit

In this case my postID = 241441

For multiple postID’s it will look like this:

add_filter('cmplz_site_needs_cookiewarning', 'my_filter_site_needs_cookiewarning');
    function my_filter_site_needs_cookiewarning($cookiewarning_required){
        global $post;
if ($post->ID==241441 || $post->ID==1 || $post->ID==2) $cookiewarning_required=false;
return $cookiewarning_required;
}

Related articles

Leave a Reply

Your email address will not be published.

Subscribe