Complianz Privacy Suite

Removing Google Maps and other services from the Cookie Blocker

Aert Hulsebos

Aert Hulsebos

Categories

Popular articles

TCF for WordPress

The Transparency Consent Framework () is an initiative by IAB Europe and IAB Tech Lab to provide a platform for vendors, publishers, and consent management

Read More

TCF V2.0 release (Update)

Update: Released on October 5th 2020 Since August 15th the Transparency and Consent Framework V2.0 from IAB Europe or V2 has been adapted by Google

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

WordPress offers filter hooks to allow plugins to modify various types of internal data at runtime.

A plugin can modify data by binding a callback to a filter hook. When the filter is later applied, each bound callback is run in order of priority, and given the opportunity to modify a value by returning a new value.

The following example shows how a callback function is bound to a filter hook.

Note that $example is passed to the callback, (maybe) modified, then returned:

function example_callback( $example ) {
    // Maybe modify $example in some way.
    return $example;
}
add_filter( 'example_filter', 'example_callback' );

If you want to know more, before adding your first add_filter(), see below source. If it’s now your first time, see our collection of filters below.

source: https://developer.wordpress.org/reference/functions/add_filter/

For example: Google Maps iFrame

Did you implement Google Maps with an iFrame? You can “unset” the iFrame from the Cookie Blocker with the following steps:

1. Find the Source URL:

This is a regular iFrame source from Google. The blue URL is an example of the URL you should copy.

iframe src=”https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d19110.61969858318!” width=”600″ height=”450″ frameborder=”0″ style=”border:0″ allowfullscreen /iframe

2. Paste your source URL in the filter below


/**
 * Filter urls for iframes that should be blocked
 * @param array $iframe_tags
 * @return array $iframe_tags
 */

function cmplz_edit_iframe_tags($iframe_tags){
    if (($key = array_search('my-source-url.com', $iframe_tags)) !== false) {
        unset($iframe_tags[$key]);
    }

    return $iframe_tags;
}
add_filter('cmplz_known_iframe_tags', 'cmplz_edit_iframe_tags');

3. Add above filter to your themes functions.php

  1. Find your themes functions.php in your website folder. It should look like wp-content/themes/(your-active-theme)/functions.php
    * when using a child theme, please choose the functions.php from your child’s theme.
  2. Back-up your functions.php before adding the filter
  3. Add your filter using WordPad, Notepad or your favorite text editor.
  4. Save and overwrite your current functions.php. Keep your back-up ready if something happens.

4. It should now be removed from our Cookie Blocker list.

Are you using an API, or do you want to unblock other services? Have a look at all our other filters.

Recent articles

Subscribe