Home > Back-end >  Add wp_enqueue_script() in functions.php
Add wp_enqueue_script() in functions.php

Time:08-05

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

CodePudding user response:

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' );
 
  • Related