Wp_head and wp_footer vs wp_enqueue_script javascript files?

It looks like you’ve overlooked the 5th input parameter of:

 wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); 

Namely the boolean $in_footer part, that will put the script in the footer, if set as true, else in the header.

You can also use $deps to handle dependencies.

Check out the Codex for more info.

=> I would stick to wp_enqueue_script() and not manually place the scripts into the header or footer.

Leave a Comment