Title: Problem loading jQuery hosted library
Last modified: August 30, 2016

---

# Problem loading jQuery hosted library

 *  Resolved [Teddy_c](https://wordpress.org/support/users/teddy_c/)
 * (@teddy_c)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/)
 * Good Afternoon,
 * I have recently modified my entire theme by creating a child theme. I uploaded
   it and so far everything was working. My custom script were executing and the
   hosted jQuery library was loading.
 * However, I recently checked the check box enqueue safe version of jQuery in the
   itheme security pluging and ever since everything went wrong. So I decided to
   re-upload my back up files via an FTP client. Unfortunately it is not working.
 * The hosted version of jQuery is not loading. Instead of having “[https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js&#8221](https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js&#8221);
   loading I have “[http://www.thesofachronicle.com/wp-includes/js/jquery/jquery.js?616696&#8221](http://www.thesofachronicle.com/wp-includes/js/jquery/jquery.js?616696&#8221);
   and “[http://www.thesofachronicle.com/wp-includes/js/jquery/jquery-migrate.min.js?616696&#8221](http://www.thesofachronicle.com/wp-includes/js/jquery/jquery-migrate.min.js?616696&#8221);
   loading. I am stuck and I cannot find any answer.
 * PS: I also reuploaded a backup version of my htaccess file.
 * Here is my code that I use in the function.php file of my child theme.
 *     ```
       <?php
       function my_init_method() {
       wp_deregister_script( 'jquery' );
       wp_register_script(   'jquery', 'ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js');
       }    
   
       add_action('init', 'my_init_method');
       ?>
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398379)
 * try this:
 *     ```
       function jquery_register() {
       if ( !is_admin() ) {
       wp_deregister_script( 'jquery' );
       wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js');
       wp_enqueue_script( 'jquery' );
       }
       }
       add_action( 'init', 'jquery_register' );
       ```
   
 *  Thread Starter [Teddy_c](https://wordpress.org/support/users/teddy_c/)
 * (@teddy_c)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398403)
 * Thank you, unfortunately it does not work. Here is my website by the way
 * [http://www.thesofachronicle.com](http://www.thesofachronicle.com)
 * Also, the version of jQuery I am trying to implement is the 2.1.4 and not the
   1.4
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398412)
 * That snippet works, and why it does not work for you is hard to tell
 *  Thread Starter [Teddy_c](https://wordpress.org/support/users/teddy_c/)
 * (@teddy_c)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398413)
 * Everything worked perfectly before for me too. Ever since I check and uncheck
   this box in itheme security it stopped working
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398425)
 * Have you checked with the “itheme” support?
    Ask if other people have similar
   complains, and if your theme is 4.2.4 compatible
 *  Thread Starter [Teddy_c](https://wordpress.org/support/users/teddy_c/)
 * (@teddy_c)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398509)
 * Problem fixed thanks to Dwiden. Please find his answer bellow:
 * ——— Solution ———-
 * Bug and you are using incorrect code in the functions.php file. If the Enqueue
   safe version of jQuery checkbox is still displayed and it is enabled please disable
   it and then click on the Save All Changes button.
 * Then in the functions.php file of your child theme change your code to look like
   this (perhaps best to do a copy\paste):
 *     ```
       function mytheme_jquery_script() {
       	wp_deregister_script( 'jquery' );
       	wp_deregister_script( 'jquery-core' );
   
       	wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', array(), '2.1.4', false);
       	wp_enqueue_script( 'jquery' );
       }
       ```
   
 * add_action( ‘wp_enqueue_scripts’, ‘mytheme_jquery_script’);
    If you already have
   a method\function being added as an action to the wp_enqueue_scripts hook in 
   the theme functions.php file you can add all lines starting with wp_ at the end
   of that method\function. The rest is then obsolete (because it is probably already
   there).
 * This should fix it.
 * In the Enqueue safe version of jQuery setting click on the ‘click here to check
   again.’ link to obtain the JQuery version being used and then refresh the iTSec
   plugin Settings page. It should now report in green:
 * Your current jQuery version is 2.1.4.
 * If the above info helped you solve the issue please mark this topic as ‘resolved’.
 * dwinden
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398520)
 * Glad to know it 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Problem loading jQuery hosted library’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [wp_enqueue_script](https://wordpress.org/support/topic-tag/wp_enqueue_script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/problem-loading-jquery-hosted-library/#post-6398520)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
