How do I properly register bootstrap JavaScript into WordPress functions.php?

As mentioned on the wp_register_script() codex page the handle:

Should be unique as it is used as a handle for later use with wp_enqueue_script().

You are using the same handle for all your scripts, which won’t work.

Besides that, if those scripts are depending on bootstrap, you have to at least register bootstrap before and add it as dependency to the custom scripts registration. Or, enqueue it before enqueuing the custom scripts with wp_enqueue_script(), which also has an dependencies parameter. Read more about the usage at the linked pages.

Leave a Comment