I wish to move jQuery to the bottom of the page on my theme, to speed up loading times.
Previously I was doing this by replacing it with Google’s CDN version but I have been told that is a bad thing to do.
How can I deregister and re-register the WordPress jQuery script and move it to the bottom without causing any problems?
You can change it by calling
add_data
method of$wp_scripts
object. This object holds all scripts and information how to render it. To force rendering script in the footer you can do it like this:P.S.: I haven’t tested it, but suppose it has to work.