0

Here's a site I'm working on...

198.1.77.196/~larog/

I've taken an older WordPress theme (Twenty Ten) and modified it to be my own theme.

Anyways, the site isn't anywhere near done, I'm just in the process of building it. One of the things I'm curious about though is why WordPress loads jQuery in the head of my site when I am always hearing people saying that you should load jQuery in the footer of your site (or after the tag) so that it helps the page to load faster.

I've Googled this and found nothing that answers my question. Any input is appreciated!

3
  • That tells me how to load jQuery in the footer instead of the head section of the page, however, I am more curious as to why WordPress has jQuery loaded in the head by default when most people suggest moving it to the footer for faster page load times.
    – DigitalSky
    Feb 11, 2014 at 7:30
  • Because the idea of inserting scripts at the bottom of the page is only a few years old and WordPress is older than that. Many plugins and themes expect it to be in the head. Feb 14, 2014 at 5:58

1 Answer 1

1

It is true that browsers choke on scripts, so generally it is best to put scripts in the footer to prevent the whole page being delayed. So putting jquery in the footer also makes sense.

However, WordPress websites usually have plugins that may also include jquery scripts, which they may load in the header without you knowing it. As long as jquery itself is not loaded, because you've put it in the footer, those scripts won't work. If those scripts control the looks of the page, you may have some very weird looking page while the browser is waiting for jquery.

So, there you have it: put jquery in the head of your WP site, because others may assume it's there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.