Moving js files to footer
-
I tried to move the jquery and other js files from header to footer to improve SEO scores with the following code but it didn’t work.
function move_jquery_to_footer() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery','https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', false, null,true); wp_enqueue_script('jquery'); } } add_action ('wp_enqueue_scripts', 'move_jquery_to_footer');
The code works for other themes, but for some reason it doesn’t work for your theme. Any reason why?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Moving js files to footer’ is closed to new replies.