What is the best/proper hook for wp_enqueue_script?
-
I’ve seen function call examples using all 3 of these action hooks to try and accomplish the same thing.
add_action('init', 'my_enqueue_js_function'); add_action('template_redirect', 'my_enqueue_js_function'); add_action('wp_head', 'my_enqueue_js_function');
If I’m only using a script for a front-end GUI, Would it be a better practice to use ‘init’ to register the scripts and then wp_head to enqueue the scripts? What, if any advantage is there to using template_redirect as opposed to wp_head?
Thanks in advance to whoever could shed some light.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘What is the best/proper hook for wp_enqueue_script?’ is closed to new replies.