After providing all the parameters in wp_register_script, we can just call the script in wp_enqueue_script() which makes everything happen. I then tried to load my script (the one that needs to be included only when the shortcode is loaded) by changing the snippet above to this: function callbackService() { ob_start(); wp_enqueue_script('angular-bundle', get_template_directory_uri() . wp_enqueue_scripts is the proper hook to use when enqueuing scripts and styles that are meant to appear on the front end. Javascript Some time we need to add script/css on plugin section. wp_enqueue_scripts - How to Enqueue Your Assets in WordPress Wordpress Enqueue scripts after user events e.g click Than, open you header.php file from you active theme and instead calling the link as you normally do, paste the following code within the head tag: ‘enqueue_scripts’) – this must come second, it’s the name you give your custom function. Save your JavaScript in a .js file and place that .js file in your theme’s js directory. This helps to reduce the page load time because it is not loading the same third … Once you have the plugin locally, open its folder in a file explorer and do a search for “wp_enqueue_script” (without quotes). You should never, ever do this.