Why isn’t my js script loading in WordPress

I am trying to add a bootstrap js script to my WordPress theme the “right” way but I’m not seeing a link to the js file in the head section of the webpage when it loads. I tried adding it to the header of the WordPress theme the “right” way but no luck. Now I’m trying in the functions.php file and still no luck.

function buns_bootstrap_run(){
    wp_register_script('bootstrap-js', get_stylesheet_directory() . '/js/bootstrap.min.js', array('jquery'),'3.2.0', false);
    wp_enqueue_script('bootstrap-js');
}

add_action('wp_enqueue_script', 'buns_bootstrap_run');

Related posts

1 comment

  1. The action isn’t named wp_enqueue_script, but wp_enqueue_scripts

    add_action('wp_enqueue_scripts', 'buns_bootstrap_run');
    

    There’s a difference between the action that’s called when scripts are to be enqueued, and the function that actually enqueues them

Comments are closed.