Custom Taxonomy-specific JavaScript

For a function that enqueues scripts, the action hook you use should actually be “wp_enqueue_scripts” for the front of the site, and “admin_enqueue_scripts” for the admin side of things. This is the proper time to enqueue scripts.

While you can technically do it anytime before wp_head, this is the best place because it’s pretty much the last possible chance to do it, thus ensuring that everything else that can be done before script output has been done, making your logic all work properly.

Leave a Comment