Title: jQuery to header
Last modified: August 21, 2016

---

# jQuery to header

 *  [kiscoeteam](https://wordpress.org/support/users/kiscoeteam/)
 * (@kiscoeteam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/)
 * Hello,
 * I am in a big problem (at least that’s the way I see it). I’ve tried plenty of
   times to move WordPress to wp_head() instead of wp_footer(), but it simply doesn’t
   work. When I try to add a script to wp_head(), it doesn’t show up either. Here
   is the code I used in theme’s function.php:
 *     ```
       if (!is_admin()) add_action("wp_enqueue_scripts", "jquery_to_top");
       function jquery_to_top() {
          wp_deregister_script('jquery');
          wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null, false);
          wp_enqueue_script('jquery');
       }
       ```
   
 * So based on the Codex, this should the jQuery script to wp_head(). But it doesn’t.

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

 *  [LabSecrets](https://wordpress.org/support/users/labsecrets/)
 * (@labsecrets)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315826)
 * Looks like your syntax is off. I believe it should be something more like this:
 *     ```
       function jquery_to_top() {
       if ( !is_admin() ) {
       add_action("wp_enqueue_scripts", "jquery_to_top");
       wp_deregister_script('jquery');
       wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null, false);
          wp_enqueue_script('jquery');
       }
       }
       ```
   
 * Also, you might checkout this resource:
    [http://stackoverflow.com/questions/4927352/adding-a-jquery-script-to-wordpress-admin](http://stackoverflow.com/questions/4927352/adding-a-jquery-script-to-wordpress-admin)
 * We do this all the time at LabZip and 1WD tv so if you need any other help, just
   drop me a line 😉
 * Cheers!
    spence
 *  [LabSecrets](https://wordpress.org/support/users/labsecrets/)
 * (@labsecrets)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315874)
 * Upon reflection.. actually, probably more like this:
 *     ```
       if ( !is_admin() ) {
       add_action("wp_enqueue_scripts", "jquery_to_top");
       }
   
       function jquery_to_top() {
       wp_deregister_script('jquery');
       wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null, false);
          wp_enqueue_script('jquery');
       }
       ```
   
 *  Thread Starter [kiscoeteam](https://wordpress.org/support/users/kiscoeteam/)
 * (@kiscoeteam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315937)
 * Still doesn’t work with any of them. Any ideas?
 *  [LabSecrets](https://wordpress.org/support/users/labsecrets/)
 * (@labsecrets)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315938)
 * Not knowing where or what you are trying to do with this… or what you have installed
   with other plugins or themes (that may be causing a conflict), the only other
   suggestion I have is to add a priority to the action (11), and see if this works.
   I’ve reverted back to the original action syntax as well.
 *     ```
       if (!is_admin()) add_action("wp_enqueue_scripts", "jquery_to_top", 11);
       function jquery_to_top() {
       wp_deregister_script('jquery');
       wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
       wp_enqueue_script('jquery');
       }
       ```
   
 *  Thread Starter [kiscoeteam](https://wordpress.org/support/users/kiscoeteam/)
 * (@kiscoeteam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315939)
 * Already tried that. Basically, I have a theme (typegrid11) and I want to move
   the jQuery script (which at the moment is in footer) in the header. I tried everything
   but it simply doesn’t work. However, if I use the above function for example 
   to change the jQuery source path, it works, I see the changes. It just won’t 
   put it in the header.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315940)
 * Where did you download this theme from?
 *  Thread Starter [kiscoeteam](https://wordpress.org/support/users/kiscoeteam/)
 * (@kiscoeteam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315941)
 * It’s a paid one from ThemeForest.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315942)
 * I’m sorry but as you are using a commercial theme, you need to seek support from
   the theme’s developer/vendor. We do not support [commercial products](http://codex.wordpress.org/Forum_Welcome#Commercial_Products)
   here.

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

The topic ‘jQuery to header’ is closed to new replies.

## Tags

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

 * 8 replies
 * 3 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/jquery-to-header/#post-4315942)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
