Complianz Privacy Suite

Adding filters with MU Plugins. Quick & Easy

Aert Hulsebos

Aert Hulsebos

Categories

Popular articles

Editing Legal Documents

The legal documents are generated by the Wizard and will show up under ‘Pages’ with a shortcode in the content. This shortcode is used to

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

You might want to change your Cookie Banner Read more URL or have your placeholders when using Complianz. To edit some features of Complianz, you will need to apply some extra code to your WordPress installation. Below we will explain how you can use so-called Must-Use plugins to apply these filters.

Do you want to know which functionalities you can add to Complianz? Visit our overview of the features and code snippets.

How to implement filters with Must-Use plugins.

Must-Use plugins, in short, is a folder in WP-Content called ‘mu-plugins’ which is a collection of files which are activated by default and cannot be deactivated in your WordPress dashboard. These files will stay put and activated even if you’re updating your WordPress installation or theme.

If you don’t have a mu-plugins folder in wp-content, you can simply open your FTP client, then add the folder under the wp-content directory. The result should look like */wp-content/mu-plugins/

To add a filter described in our hooks and filters overview you can copy/paste the code to your favorite text editor and change the variables as described in the code. 

For example:

Do you want to unset a service from the Cookie Blocker so it will load before consent? You should copy/paste the below code in your text editor and change my-blocked-script-tag.js to the social marker you would like to unset.

/**
function cmplz_edit_script_tags($script_tags){
if (($key = array_search(‘my-blocked-script-tag.js’,
$script_tags)) !== false) {
unset($script_tags[$key]);
}
return $script_tags;
}
add_filter(‘cmplz_known_script_tags’, ‘cmplz_edit_script_tags’);

How to find you marker?

For Chrome:

Right click
Click Inspect
Find “Sources” in the top navigation.
Search for the URL corresponding to your service on the left hand side under “Page”.
Find the URL in our list markers, see below for markers by category.
Use the URL to unset this specific service.

Saving your new filter and uploading it with FTP

  1. After editing the filter, save your file ending with .php. For example unsetservice.php
  2. Upload unsetservice.php to wp-content/mu-plugins/ via FTP
  3. Check if the service will be set before consent.

 Done!

Below you can find an example of the code you need if you want to prevent Complianz from blocking Dailymotion. The string as listed above is inserted in the code, then this code is placed in a mu-plugin.

Not sure what to add in the variables? Ask support, we are happy to help!

/**
function cmplz_edit_script_tags($script_tags){
if (($key = array_search(‘dailymotion.com/embed/video/’,
$script_tags)) !== false) {
unset($script_tags[$key]);
}
return $script_tags;
}
add_filter(‘cmplz_known_script_tags’, ‘cmplz_edit_script_tags’);

Related articles

3 Responses

Leave a Reply

Your email address will not be published.

Subscribe

We have released 4.0 for Premium. For more information about Cookiedatabase.org and New Features...