为什么不是';在WordPress中加载js脚本


Why isn't my js script loading in WordPress

我正试图以"正确"的方式将引导程序js脚本添加到我的WordPress主题中,但当它加载时,我在网页的头部没有看到js文件的链接。我试着以"正确"的方式将其添加到WordPress主题的标题中,但没有成功。现在我正在尝试functions.php文件,但仍然没有成功。

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

该操作的名称不是wp_enqueue_script,而是wp_enqueue_scripts

add_action('wp_enqueue_scripts', 'buns_bootstrap_run');

脚本入队时调用的操作和实际入队的函数

之间存在差异