Skip to content

Commit

Permalink
feat(core): Add filter to google maps script url query (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
ediamin authored and sabbir1991 committed Jul 24, 2018
1 parent 11edf05 commit dfddfb1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions includes/class-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,16 @@ function dokan_dashboard_scripts() {
* @since 2.5.3
*/
function load_gmap_script() {

$scheme = is_ssl() ? 'https' : 'http';
$api_key = dokan_get_option( 'gmap_api_key', 'dokan_general', false );

if ( $api_key ) {
wp_enqueue_script( 'google-maps', $scheme . '://maps.google.com/maps/api/js?key=' . $api_key );
$query_args = apply_filters( 'dokan_google_maps_script_query_args', array(
'key' => $api_key,
) );

$src = add_query_arg( $query_args, 'https://maps.googleapis.com/maps/api/js' );

wp_enqueue_script( 'google-maps', $src, array(), false, true );
}
}

Expand Down

0 comments on commit dfddfb1

Please sign in to comment.