I am trying to load JS files in my theme's to footer.All my custom JS files are being added to WordPress using
wp_enqueue_script, but i am unable to find any way which will help me to load them in footer.
one possible way is to
remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); add_action('wp_footer', 'wp_print_scripts', 5); add_action('wp_footer', 'wp_enqueue_scripts', 5);
but that means , I need to list down all possible JS files being used in plugins and than remove those from
header and add them to
footer, but that seems a bit strange to me as I need to take care what new plugin i have added or removed.
Is there any other alternate where i can let Wordpress load those JS files (including Plugin's) in footer section.
Since I can add/ remove plugin, so i am not sure how to handle it.