0

my WordPress theme uses a Google maps script with a default key. I couldn't find a way to change the key neither couldn't find which function is generating it.

I've tried to add my own script at the header.php but that will cause multiple google API errors.

Is there any way to fix this?

2
  • 1
    The only way is to work out how it's being generated, assuming it isn't hardcoded.
    – vancoder
    Sep 22 at 17:35
  • Search all your files for wp_head (in an add_action line), wp_enqueue_script or wp_localize_script: it's either added with one of those or in the header.php template in your theme.
    – Rup
    Sep 22 at 17:57
0
//use this to see what is the name of script. add this to functions.php
global $wp_script;
var_dump($wp_script);
//now remove the script
function wpdocs_dequeue_script() {
    wp_dequeue_script( 'google-maps' );
    wp_deregister_script( 'google-maps' );
}
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );

Not the answer you're looking for? Browse other questions tagged or ask your own question.