0

I enqueued a script like google-map.

I enqueued in front-end and this works well. (I edited my key in url)

add_action('wp_enqueue_scripts', 'enqueue_fn');
function enqueue_fn(){
    wp_register_script( 'daum_map_api', '//dapi.kakao.com/v2/maps/sdk.js?appkey=THIS PART IS MY KEY&libraries=services', null, null, true );
    wp_enqueue_script( 'daum_map_api' );
}

But when I enqueued it in wp-admin, it generates errors.

add_action( 'admin_enqueue_scripts', 'admin_enqueue' );
function admin_enqueue(){
   wp_register_script( 'daum_map_api', 'https://dapi.kakao.com/v2/maps/sdk.js?appkey=THIS PART IS MY KEY&libraries=services' );
   wp_enqueue_script( 'daum_map_api' );
}

enter image description here

4
  • I found somethig. '&' this character changes like this ';' in url. how can I put the '&' character in there?
    – JJang
    Commented Jan 6, 2018 at 8:15
  • '&' instead of '&' also changes to ';'
    – JJang
    Commented Jan 6, 2018 at 8:42
  • Are both your frontend and your backend running via https? Is the API key identical?
    – janh
    Commented Jan 6, 2018 at 8:54
  • I am developing this site in localhost, now. And api key is correct. what does it meant that running via https? sorry.
    – JJang
    Commented Jan 7, 2018 at 0:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.