Today I was working on a website restyle when I ran into the following interesting situation. After updating WordPress and installing the Jetpack plugin I noticed two things.

1. The Sharing functions More button would not work on mouse-over. This was obviously due to jQuery conflicts.
2. The Publicize to facebook function leaves out the category slug, but that’s a whole nother story.

jQuery-logoThe site uses a theme which used version 1.5.1 of the jQuery library so after ‘googling‘ and playing with the jQuery Migrate plugin I decided to just go ahead and upgrade with version 1.9.1. All fine and dandy until I refreshed the page and the slider was not working anymore. YIKES. Nor was there any content visible. HELP! Thankfully after some more scouting the interwebs I found this helpful post which convinced me to let WordPress handle the jQuery since it is already loading a recent version anyway. But… nowhere on the webs could I find any information on how to do that. After a little trial and error I noticed this works (it is of course very theme-dependent, but hopefully sends someone in the right direction):

1. Log into WordPress as an Admin
2. Make sure you have a copy of your db and files. Duh!
3. Find your theme in the Theme Editor.
4. Try to identify in which file the jquery is loaded. In my case it was a file called themescripts.php but be sure to look in init files, header files or your theme-functions.php
5. I changed these lines:

wp_deregister_script('jquery');
wp_register_script('jquery', get_template_directory_uri().'/js/jquery-1.5.1.min.js', false, '1.5.1');
wp_enqueue_script('jquery');

6. to look like these lines:

//wp_deregister_script('jquery');
//wp_register_script('jquery', get_template_directory_uri().'/js/jquery-1.5.1.min.js', false, '1.5.1');
wp_enqueue_script('jquery');

7. and press Save.

wordpress-logo-stacked-rgb

Now basically what that does is it: a) the wp_deregister_script function removes a registered script from loading. commenting out this line makes sure the default jQuery loaded by WordPress gets… loaded. b) the wp_register_script function registers a new scriptfile into your page. commenting out this line prevents loading that old jQuery version that gave you the headache to begin with. So thats it I hope this helps save lives or at least some valuable time. Feel free to leave a comment if you have dealt with this. Or are going to.