wp_enqueue_script in the footer wp_enqueue_script in the footer wordpress wordpress

wp_enqueue_script in the footer


By default WordPress default JavaScripts won’t move to the footer, a workaround is to add its path :

wp_enqueue_script('jquery','/wp-includes/js/jquery/jquery.js','','',true);

See detailled post about this


Make sure you have the wp_footer() right before the </body> tag. See the $in_footer parameter for more info. You also need to call this before wp_head has run. Try also using this action.

add_action('wp_enqueue_scripts', 'add_scripts_to_pages');

Another thing to try is using NULL as 3rd and 4th parameters.


As an addition to @Nick's answer;

if you have a PHP problem before wp_footer() you wont be able to see your script in footer. Source is https://wordpress.org/support/topic/enqueuing-scripts-in-footer-does-not-working-with-wordpress-36.