Complianz Privacy Suite

Excluding Pages from the Cookie Notice

Aert Hulsebos

Aert Hulsebos


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 Another plugin called AMP for

Read More
Share on facebook
Share on twitter
Share on 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', 'cmplz_my_filter_site_needs_cookiewarning');
function cmplz_my_filter_site_needs_cookiewarning($cookiewarning_required){
  if (241441==url_to_postid(esc_url_raw((is_ssl() ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"))) $cookiewarning_required=false;
  return $cookiewarning_required;

In this case my postID = 241441

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:


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.