Tagged: disable, enfold, Google Maps API
-
AuthorPosts
-
December 5, 2018 at 6:14 pm #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' ); } }
December 10, 2018 at 6:41 pm #1043251Hey 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,
NikkoJanuary 21, 2019 at 11:12 pm #1056907if 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
January 22, 2019 at 8:27 am #1057099Hi (Email address hidden if logged out) ,
Thanks for sharing, much appreciated :-)
Best regards,
RikardFebruary 18, 2020 at 8:19 am #1185557hello there I am trying to disable google maps as well but these codes are not working for me. Can you please help? thanks!
February 18, 2020 at 9:08 am #1185560I 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!
February 18, 2020 at 9:28 am #1185563Hi 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,
NikkoFebruary 18, 2020 at 9:30 am #1185564Yes, 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…
February 18, 2020 at 9:45 am #1185566and 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.
February 18, 2020 at 1:24 pm #1185635Hi 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,
NikkoFebruary 18, 2020 at 1:37 pm #1185647did 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?
February 18, 2020 at 5:12 pm #1185742Hi 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,
NikkoFebruary 19, 2020 at 6:05 pm #1186129I 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!
February 20, 2020 at 8:59 am #1186255any news on this? thanks!
February 21, 2020 at 9:03 am #1186635hi 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
February 22, 2020 at 3:17 pm #1186977Hi,
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,
NikkoFebruary 22, 2020 at 4:51 pm #1186984thanks for the help – it looks like it is working! I will do some tests in the next few hours. thanks again
February 22, 2020 at 6:00 pm #1186987Hi studiono,
We’re glad that we could help :)
Just let us know your feedback.Best regards,
NikkoMay 10, 2023 at 4:44 pm #1407014Hy, 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=…….”I am using Enfold 5.2.1
Best regards
AndreasMay 10, 2023 at 4:47 pm #1407015In the backend i already choosed
Google Services > Google Maps > deactivate google maps
but the js to google maps is still loading.May 10, 2023 at 6:25 pm #1407031Hi andreask0,
Can you give us a link to your site?
Best regards,
NikkoMay 10, 2023 at 7:24 pm #1407042sure
May 12, 2023 at 10:30 am #1407201Hi 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,
NikkoMay 12, 2023 at 10:55 am #1407208I 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
May 13, 2023 at 10:59 pm #1407313Hi 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,
NikkoMay 15, 2023 at 11:36 am #1407432Sorry 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.
May 16, 2023 at 12:56 am #1407497Hi 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,
NikkoMay 16, 2023 at 11:20 am #1407551Hy Nikko,
ok – I’m really embarrassed and sorry for stealing your time.
Thanks a lot for your service.Best regards.
May 16, 2023 at 11:49 am #1407564Hi 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 -
AuthorPosts
- The topic ‘Proper method to disable Google Maps in Enfold’ is closed to new replies.