Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1364442

    Hi there,

    I noticed that scripts from maps.googleapis.com are loaded on every page in the admin backend, even though Google Maps is turned off in the theme options. I searched the forum and tried quite a few of the suggestions, but, to no avail.

    I finally was able to stop these requests by making a small change to a function in wp-content/themes/enfold/framework/php/class-gmaps.php:

    public function handler_wp_register_scripts()
    {
    	// this prevents the requests to maps.googleapis.com, if Google Maps is turned off in theme options
    	if( $this->is_loading_prohibited() )
    	{
    		return;
    	}
    	// leave rest of function unchanged
    }

    Although this works, I’d rather not change a core file. Plus, I’m new to Enfold and I am probably missing a better solution. Can someone please help me how to achieve the same, but do it properly? ;-)

    Thanks,

    Chris

    • This topic was modified 3 years, 4 months ago by Chris.
    #1364543

    Hi Chris,

    You can use this filter in your child theme functions.php file:

    function ava_google_maps_skip_loading()
    {
    	return "skip_loading";
    }
    add_action('avf_skip_enqueue_scripts_backend_gmaps', "ava_google_maps_skip_loading");

    Best regards,
    Rikard

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.