Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #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 5596

    Is there really no alternative? Does the theme option render the same effect (no loading at all)?

    Thanks for your advice,
    Rob

    #1331262

    you 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);
    }
    #1331270

    Hi 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,
    Rob

    P.S.
    Solved, can be closed.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Filter to prevent Google Maps API loading in backend deprecated?’ is closed to new replies.