Fixing your WordPress menu – the hard way

Lately some people are complaining about their menus that suddenly stop functioning. Only the first option shows and the mouse-over effect doesn’t seem to work. This seems to happen to all kind of WordPress theme’s. For example Photocrati users are complaining about this. In this post I’ll show you how to work around this, the hard and ugly way.

What basically happens here is that some themes (like Photocrati) use an old technique/function from jQuery. Since jQuery comes shipped with most WordPress installs this error will automatically happen if the code being used is vulnerable for it.

I will only show you how to make your site work with an old version of jQuery. I’m not going to fix the code your theme is using. So you’d best fix your themes codebase a.s.a.p. (or let the creator fix it for you) so you can use the more recent version again. This is only a work-around, not an actual fix!

The easiest way to work around this would be to de-register the used jQuery and then simply re-register it. We can then call on an old version of jQuery like this:

wp_deregister_script('jquery'); // deregister packaged jquery
wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js');

This should fix your issues with your menu. If for some reason however it doesn’t fix your issues, replace the required pieces of code manually. Dig through the files that come with your theme to check where the jQuery scripts are included (usually using wp_enqueue_script). As soon as you’ve found it, replacte that with this:

wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js');

That’s it!