How to Put All JavaScripts at Bottom in WordPress
Yesterday, when I was just looking for new emails in my inbox I found an interesting question about how to put all JavaScripts at bottom in WordPress. Did you know that why should we put JavaScripts at bottom? Because, it’s an effective way to load all the scripts at bottom in WordPress that boost the website speed. One of our visitors asked us how they can move JavaScripts at the bottom in WordPress to increase Google pagespeed score for their blog. In this article, I will show you how to put all JavaScripts at bottom in WordPress, so that you will be able to improve your site load time and your Google pagespeed score.
Putting All JavaScripts at Bottom in WordPress
All you need to do is to add the following line of codes in your functions.php file.
remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'wp_enqueue_scripts', 1); add_action('wp_footer', 'wp_print_scripts', 5); add_action('wp_footer', 'wp_enqueue_scripts', 5); add_action('wp_footer', 'wp_print_head_scripts', 5);
Why does this flash when clicking on links briefly showing unstyled css?
Thanks
Jeff
Hey @Jeff,
Can you please explain little bit more, I don’t understand what are you talking about?
It briefly shows an unstyled page for a split second when you navigate between links
Well, clear out the browser cookies please… Hope this problem will settle down… If this doesn’t work, let me show the problem’s screenshots… @Jeff