[Google Maps] Can't hide other businesses and POIs in Google Maps

Hi,

I'd like POIs and other business not to be shown in my Google Maps.

For instance, in this map > https://support.namirial.com/en/information-request/

I don't want to see "Summer Jamboree" and "Shade – La Serie" POI.

Thanks in advance.

  • Ash
    • Code Norris

    Hello TeamWeb

    I am afraid, this is not possible out of the box. Those locations are picked by the google map itself.

    But it might be possible with some custom code. We have sent your issue to our second level support team. Please note that, they deal with more complex issues, so there might be little delay. We appreciate your patience on this.

    Have a nice day!

    Cheers,

    Ash

  • Matteo
    • WP HERO

    Hi Ash,

    thanks for your answer. No problem if we’ll have to deal with custom code. I think this is a fairly common need, especially for companies, so maybe you could consider setting it as a plugin option and include it in one of the next updates.

    I’m waiting for your answer,

    regards!

  • Kostas
    • Deputy CTO

    Hi TeamWeb and sorry for the late reply!

    Could you try by adding the following code into your functions.php ( preferably your child themes ):

    add_action( 'wp_footer', 'custom_remove_map_poi' );
    function custom_remove_map_poi() {
    ?>
    <script type="text/javascript">
    ( function( $ ) {
    $( document ).bind(
    "agm:init",
    function( e, map, data ) {
    var styles = {
    default: null,
    hide: [
    {
    featureType: 'poi.business',
    stylers: [{visibility: 'off'}]
    },
    {
    featureType: 'transit',
    elementType: 'labels.icon',
    stylers: [{visibility: 'off'}]
    }
    ]
    };

    map.setOptions({styles: styles['hide']});
    }
    );
    } ( jQuery ) );
    </script>
    <?php
    };

    Tell me if this works for you or if you need further tweaks!

    Regards,

    Konstantinos