I have been trying to force my wordpress website to use a specific version of jquery. Since the last update from wordpress obligated users to use version 1.9, my menu bars are now not working correctly because of this. Until I find a fix from this upgrade, I would like to force my website to use a previous version of jquery. To this effect I have already tried two things:
-
I edited the functions.php file to add some code. I got this from this link: (http://www.wpbeginner.com/wp-themes/replace-default-wordpress-jquery-script-with-google-library/)
//Making jQuery Google API function modify_jquery() { if (!is_admin()) { // comment out the next two lines to load the local copy of jQuery wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js', false, '1.8.1'); wp_enqueue_script('jquery'); } } add_action('init', 'modify_jquery');
-
I edited the default-options.php file and where it said ‘jquery’ => true, I changed it to false.
However, none of these options have worked and my website still loads version 1.9.1 of jquery. The link to the site is www.fiestacolegial.com
Please let me know what I can do to force a previous version of jquery or another tweak to fix the submenus not loading.
Thanks!
So after attempting the options mentioned above it didn’t work. But then I found this code from another website and it did the trick.
You need to add this code to the Them Functions (functions.php):
And you also should go to the default-options.php and where it says ‘jquery’ => true change it to says false.
Also… in the code provided above, where it says 1.7.1 change it to which ever version you need. In my case I needed 1.8.1 to work with my wordpress template.
Thanks to all that contributed to this answer 🙂