Open balbuf opened 8 years ago
Can you tell me where the API key needs to be added in the code?
Add this code to your theme or a custom plugin to add an API key
add_filter( 'script_loader_src', 'gfgp_api_key', 10, 2 );
function gfgp_api_key( $src, $handle ) {
if( 'google-places' === $handle ) {
$src = add_query_arg( array(
'key' => 'your_key_here'
), $src );
}
return $src;
}
Worked for me, Thanks!
add_filter( 'script_loader_src', 'gfgp_api_key', 10, 2 ); function gfgp_api_key( $src, $handle ) { if( 'google-places' === $handle ) { $src = add_query_arg( array( 'key' => 'your_key_here' ), $src ); } return $src; }
I am not sure on where to put this code.
Is there any setup configuration in the plugin?
add_filter( 'script_loader_src', 'gfgp_api_key', 10, 2 ); function gfgp_api_key( $src, $handle ) { if( 'google-places' === $handle ) { $src = add_query_arg( array( 'key' => 'your_key_here' ), $src ); } return $src; }
I am not sure on where to put this code.
Is there any setup configuration in the plugin?
your themes functions.php file
API key is currently optional to use the Places API, but some users may wish to use theirs.