Skip to content
Advertisement

Add wp_enqueue_script() in functions.php

I’m trying to add Maps JavaScript API in wordpress without plugins. I have seen that to do that I need to use the wp_enqueue_script() function.

However, I would like to know what is the correct way to add this function in the functions.php file?

Thank’s

Advertisement

Answer

function enqueue_custom_scripts() { 
  
    wp_enqueue_script( 'script-nname', 'https://www.script.com/script.js' ,array('jquery'),NULL,true );
}
add_action( 'wp_enqueue_scripts', 'enqueue_custom_scripts' );
 
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement