WordPress multiple jQuery inclusion fix

wordpress jquery multiple loading

loading the library just once is sufficient

WordPress loads jQuery more than once

Ever look at your WordPress page in Firebug and notice that jQuery is sometimes loaded more than once? Have you ever tried to use the Google jQuery content delivery network to improve page load speeds only to be thwarted by a second jQuery file that cannot be found inside your header.php file?

We can fix that!

Here is a smart loading jQuery main file that prevents multiple jQuery inclusions in your WordPress pages (and uses the Google Libraries API content distribution network), making your pages load quicker and more efficiently.

Just put this in at the top of your functions file:

if( !is_admin()){
   wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false, '1.6.2'); 

If you download our functions file below, it would be best to copy over the contents of this file into your existing functions.php file so as not to mess up your theme’s other processes (but you are welcome to replace it too).

Once you add in the code from our file, you’re done! No need to do anything else!


Also included in the download file are two bonus functions, one that will create a dynamic copyright based on your WordPress post history (year of earliest post to year of newest), and another that will include your Google Analytics tracking into your page footer.

To use the copyright function, paste this into you footer.php:

<?php echo iw_copyright();?>

and to use the Google Analytics function, paste this into your footer:

<?php add_googleanalytics();?>

Grab it while it’s hot!

Download jQuery WordPress fix

Support and questions

Please direct any inquires for this file in the comments below.

Related Posts
  • Xalid

    hi thanks for the blog.

  • tracourse

    Just want to say what a great blog you got here!I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work! Thumbs up, and keep it going!

  • bet365

    hello! This was a really exceptional Topics!
    I come from roma, I was luck to discover your subject in digg
    Also I get a lot in your blog really thank your very much i will come daily

  • Bucknell

    I’ll definitely be watching you!

  • Den

    Hey! Just thought I’d chime in. I really enjoyed your post. Keep up the awesome effort.

  • Karl

    Nice one, might come in handy in the near future

  • weia

    Cool post! Thanks for the script fix!

  • sun e

    so amazing!!! this is exactly the kind of stuff i was looking for – thanks for this

  • eric

    Hey, I attempted to email you about this article that i’ve a few inquires, but can’t seem to reach you. Please email me when have a minute. Thanks.

  • http://electrokami.com Metawriter

    What seems to be the problem eric?

  • gus

    Is there any method you can help me with this service?

  • ligse

    Someone I work with visits your blog frequently and recommended it to me to read too. The writing style is great and the content is top-notch. Thanks for the insight you provide the readers!

  • thula

    thanks! worked perfectly :)

    • http://electrokami.com Metawriter

      No problem!

  • AJ

    Thank you so very much for posting this… Absolutely LOVE it!!

  • Marty

    Thanks for this post

  • geonersti


  • Lowco

    Glad I discovered this!