I was just wondering if anyone could help me out with this query.
In my WordPress theme, in the functions.php file I was adding in jQuery like so…
wp_register_script(‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');
I’ve been doing this for a while however today this stopped working, and to fix the issue I had to change it to the following, note the 1.8.3 version number.
wp_register_script(‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
Could anyone enlighten me to why this happened and could this potentially happen again, If so, is there anything I can do to stop it happening?
Thanks in advance.
The reason it stopped working today is that JQuery 1.9 was just released yesterday and this deprecated a few functions that you might have been using. The
https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.jswill always link to the latest code point released, so you unknowingly switched from the previous release to 1.9 and some of your functions stopped working. By usinghttp://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.jsyou will always be using the same version of jquery, even when jquery 2.0 is released in the upcoming weeks(or days or months) and your code will be more stable. The link I provided in the comment of your question goes more in depth about why it is bad to use the latest release automatically. http://www.impressivewebs.com/linking-to-jquery/.Here is a link to the release notes for 1.9 that explains the changes you implemented by accident – http://jquery.com/upgrade-guide/1.9/#changes-of-note-in-jquery-1-9
And here is jquery’s blog post about 1.9 and 2.0 from January 15th – http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/