Skip to content

Instantly share code, notes, and snippets.

@kprajapatii
Last active September 5, 2016 05:43
Show Gist options
  • Save kprajapatii/dd617fc89f25d24227de73b6e072e6a9 to your computer and use it in GitHub Desktop.
Save kprajapatii/dd617fc89f25d24227de73b6e072e6a9 to your computer and use it in GitHub Desktop.
Fixing Google Maps error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors." Put code in your current theme functions.php file.
<?php
// Fixing Google Maps error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors."
function geodirectory_fix_multiple_google_maps_api() {
$dequeue_handle = 'google-maps'; // script handle to dequeue script
if ( wp_script_is( 'geodirectory-googlemap-script', 'enqueued' ) && wp_script_is( $dequeue_handle, 'enqueued' ) ) {
wp_dequeue_script( $dequeue_handle );
}
}
add_action( 'wp_enqueue_scripts', 'geodirectory_fix_multiple_google_maps_api', 101 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment