Viewing 29 posts - 1 through 29 (of 29 total)
  • Author
    Posts
  • #1041325

    Hello Kriesi Team –
    I’ve reviewed several forum replies. Which of these is the proper way to disable Enfold’s Google Maps API? Also, the most recent change log entry says “improved: Google maps values can be filtered programmatically now” – what does that mean?

    add_action('init', 'ava_deregister_google_map_scripts', 30);
    function ava_deregister_google_map_scripts() {
        wp_deregister_script('avia-google-maps-api');
        wp_deregister_script('avia_google_maps_front_script');
        wp_deregister_script('avia_google_maps_api_script');
        wp_deregister_script('avia_google_maps_widget_admin_script');
    }

    —OR—

    //add_filter('avf_gmap_vars', 'avf_gmap_vars_disable', 10, 1); 
    function avf_gmap_vars_disable($map) {
    	if(!is_admin()) {
    		$map = null;
    	}
    	return $map;
    }
    
    add_filter('avf_load_google_map_api_prohibited', 'avf_load_google_map_api_prohibited_true', 10, 1);
    function avf_load_google_map_api_prohibited_true($prohibited) {
    	if( is_admin() ) $prohibited = true;
    	return $prohibited;
    }
    
    add_action('wp_enqueue_scripts', 'ava_deregister_gmaps', 9999);
    function ava_deregister_gmaps() {
    	if(is_admin()) {
    		wp_deregister_script( 'avia-google-maps-api' );
    		wp_deregister_script( 'avia_google_maps_front_script' );
    		wp_deregister_script( 'avia_google_maps_api_script' );
    		wp_deregister_script( 'avia_google_maps_widget_admin_script' );
    	}
    }
    #1043251

    Hey Julie,

    This code should do:

    add_filter( 'avf_load_google_map_api', '__return_false' );

    The codes above just deregisters the js scripts which are used for enfold’s google map integration which should also work.

    Best regards,
    Nikko

    #1056907

    if we are talking about Enfold 4.5x the correct solution:

    add_filter( ‘avf_load_google_map_api_prohibited’, ‘__return_true’ );

    reference in class-gmaps.php line 141

    This disables all googlemap scripts handles frontend: avia_google_maps_front_script and backend: avia-google-maps-api, avia_google_maps_api_script

    #1057099

    Hi (Email address hidden if logged out) ,

    Thanks for sharing, much appreciated :-)

    Best regards,
    Rikard

    #1185557

    hello there I am trying to disable google maps as well but these codes are not working for me. Can you please help? thanks!

    #1185560

    I have to add this: I tried disabling with the option in Enfold Settings (Google Services) but it is still there. I have problems with a plugin (Advanced Google Maps Plugin for WordPress) as google maps js api is included multiple times in the backend. I have tried with a fresh wordpress install from scratch and the issue comes back every time I install Enfold (even if I disable google maps in the google services section). please help!

    #1185563

    Hi studiono,

    Did you put this code at the bottom of your child theme’s functions.php?

    add_filter( 'avf_load_google_map_api_prohibited', '__return_true' );

    Best regards,
    Nikko

    #1185564

    Yes, and I still see the error “You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.” in the console – with the plugin not working the right way in the backend…

    #1185566

    and I can also confirm the issue is with enfold – if I choose another theme in the same wordpress installation – I don’t see anymore that error. So Enfold calls multiple google maps APIs in the backend even if disabled.

    #1185635

    Hi studiono,

    Can you try to edit class-gmaps.php located in wp-content > themes > enfold > framework > php folder, and find this code (line 114 in Enfold 4.7.3):

    add_action('admin_footer', array( $this, 'handler_wp_admin_footer' ), 999999 );

    replace with:

    // add_action('admin_footer', array( $this, 'handler_wp_admin_footer' ), 999999 );

    Let us know if this helps.

    Best regards,
    Nikko

    #1185647

    did that but it still doesn’t work.

    by the way isn’t not good to edit that files? What is going to happen at the next update?

    #1185742

    Hi studiono,

    Yes, it’s not the best practice to edit core files, but it’s a way of trying to debug some issue.
    Advanced Google Maps Plugin for WordPress is a paid plugin and I can’t test it on my end though I tested with a free one called WP Google Maps but I didn’t have any issue.
    Can you create a staging site for us to check? it’s basically a clone of your site in your subdomain.
    Here’s a guide on how to create it: https://themeisle.com/blog/wordpress-staging-site/
    Then please provide both admin and ftp access and post it in private content, so we can try to debug the issue.

    Best regards,
    Nikko

    #1186129

    I have created a staging site and an ftp access for you guys. please let me know how to fix this as it is blocking the development of our website. thanks!

    #1186255

    any news on this? thanks!

    #1186635

    hi guys we really need to solve this as soon as possible as we can not finish the website as long the google maps api disabling button isn’t working as it should. please let me know something! Thanks

    #1186977

    Hi,

    We apologize for the delayed response.
    It can be fixed by adding this code in functions.php: https://pastebin.com/FABVSC5J
    You can view the results in the staging site.

    Best regards,
    Nikko

    #1186984

    thanks for the help – it looks like it is working! I will do some tests in the next few hours. thanks again

    #1186987

    Hi studiono,

    We’re glad that we could help :)
    Just let us know your feedback.

    Best regards,
    Nikko

    #1407014

    Hy, i have the same problem now.
    I need to get rid of maps to be compliant with the dsgvo.
    But nothing of the above code is working for me.

    This is stil there:
    “<script type=’text/javascript’ src=’https://maps.google.com/maps/api/js?callback=…&#8230;.”

    I am using Enfold 5.2.1

    Best regards
    Andreas

    #1407015

    In the backend i already choosed
    Google Services > Google Maps > deactivate google maps
    but the js to google maps is still loading.

    #1407031

    Hi andreask0,

    Can you give us a link to your site?

    Best regards,
    Nikko

    #1407042

    sure

    #1407201

    Hi andreask0,

    Thanks, can you setup a staging for us? basically it’s just a clone of your live site.
    So we can try to check further without causing any issues on your live site.

    Here’s an article that should help with cloning your site: https://themeisle.com/blog/clone-a-wordpress-website

    Best regards,
    Nikko

    #1407208

    I think you can try your fixes on the live site.
    There is not so much traffic there and it will be only a few minutes i think.
    I also made a backup if something would turn wrong.

    • This reply was modified 1 year, 7 months ago by Nikko. Reason: security
    #1407313

    Hi andreask0,

    I tried to login with the credentials you posted however, it returns: ERROR: The username or password you entered is incorrect., please check.
    Please post the credentials in private content.

    Best regards,
    Nikko

    #1407432

    Sorry for that – here is the new password (i tested it):
    [moved to private content]

    Best regards
    Andreas

    • This reply was modified 1 year, 7 months ago by Nikko.
    #1407497

    Hi Andreas,

    Thanks for giving us admin access.
    I have checked it and the option was working properly, however, the only reason google maps was loading is because of the WP Maps being activated.
    I deactivated it temporarily to see if the js files of google maps were still loading and it does not load but after re-activating the plugin, those js files are loaded again.

    Best regards,
    Nikko

    #1407551

    Hy Nikko,
    ok – I’m really embarrassed and sorry for stealing your time.
    Thanks a lot for your service.

    Best regards.

    #1407564

    Hi Andreas,

    No worries :)
    I’m glad that we could help you.
    Thanks as well for using Enfold and have a wonderful day!

    Best regards,
    Nikko

Viewing 29 posts - 1 through 29 (of 29 total)
  • The topic ‘Proper method to disable Google Maps in Enfold’ is closed to new replies.