-
AuthorPosts
-
December 1, 2021 at 9:00 pm #1331223
Hi,
On October 28 Ismael helped me with two filters to prevent Google Maps and Google Maps API loading in the backend, see post https://kriesi.at/support/topic/validity-of-code-to-disable-google-maps/#post-1326839
No complaints, that worked great.
But today I found this warning after activating wp-debug:
Deprecated: avf_load_google_map_api_prohibited is deprecated since version 4.5.7.1 with no alternative available. Filter was replaced by theme option in /wp-includes/functions.php on line 5596Is there really no alternative? Does the theme option render the same effect (no loading at all)?
Thanks for your advice,
RobDecember 2, 2021 at 9:42 am #1331262you are concerning to this code ?
add_filter( 'avf_load_google_map_api_prohibited', '__return_true' );maybe that worked :
add_filter( 'avf_load_google_map_api', '__return_false' );you can try this:
function disable_google_map_api($load_google_map_api) { $load_google_map_api = false; return $load_google_map_api; } add_filter('avf_load_google_map_api', 'disable_google_map_api', 10, 1);or that:
add_action('after_setup_theme', 'ava_disable_gmap'); function ava_disable_gmap() { add_filter('avf_load_google_map_api', function($load_google_map_api) { $load_google_map_api = false; return $load_google_map_api; },10,1); add_filter('avia_google_maps_widget_load_api', function($load_google_map_api) { $load_google_map_api = false; return $load_google_map_api; },10,1); }December 2, 2021 at 10:46 am #1331270Hi Guenni,
Thanks for your help. Yes, that part of the API filter was the problem, as you suspected. Indeed this works fine, like you said:
function disable_google_map_api($load_google_map_api) { $load_google_map_api = false; return $load_google_map_api; } add_filter('avf_load_google_map_api', 'disable_google_map_api', 10, 1);Good catch by you, I had not even noticed the filter name change. :-)
I was baffled because it seemed strange that the filter had been deprecated within a month and without mention in the changelog. Thanks for your sharp eye and help!Have a good day,
RobP.S.
Solved, can be closed. -
AuthorPosts
- The topic ‘Filter to prevent Google Maps API loading in backend deprecated?’ is closed to new replies.
