Title: javascript won&#039;t load in header
Last modified: August 24, 2016

---

# javascript won't load in header

 *  [keligijus](https://wordpress.org/support/users/keligijus/)
 * (@keligijus)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/javascript-wont-load-in-header/)
 * I need this JS to be loaded in the header, but no matter what I do, it’s still
   loaded at the bottom of the page.
 * Here’s the set up of theme-functions.php:
 *     ```
       function ct_register_cssjs() {
         wp_register_script('gmaps', 'http://maps.google.com/maps/api/js?sensor=false', '', '1.0', false);
         wp_register_script('marker', get_template_directory_uri() . '/js/markerwithlabel.js', 'gmaps', '1.0', true);
       //other scripts cut for brevity
       }
   
       add_action('wp_enqueue_scripts', 'ct_register_cssjs');
   
       function ct_init_scripts() {
         wp_enqueue_script('gmaps');
         wp_enqueue_script('marker');
       //more scripts..
       }
       add_action('wp_enqueue_scripts', 'ct_init_scripts');
       ```
   
 * I need, but can’t get the gmaps script to be placed in the <head>
    I’ve tried
   using blank space instead of false for _$in\_footer_ variable, but this hasn’t
   worked either.

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

 *  [AJ Mallory](https://wordpress.org/support/users/jasonm4563/)
 * (@jasonm4563)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/javascript-wont-load-in-header/#post-5996924)
 * Give this a try:
    `wp_register_script('gmaps', 'http://maps.google.com/maps/api/
   js?sensor=false', '', '1.0');`
 * If that doesn’t work it might help to provide a link to the site and know what
   theme you are trying to use. You could also try switching to a WordPress default
   theme and see if your code works there. Also might try disabling any other plugins
   to make sure they are not causing an issue with what you are trying to do.
 *  Thread Starter [keligijus](https://wordpress.org/support/users/keligijus/)
 * (@keligijus)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/javascript-wont-load-in-header/#post-5996950)
 * Thanks a lot AJ Mallory!
 * Tried your version too, as false is the default, but no luck here.
 * The problem was with a MapifyPro plugin. It also uses the same script and somehow
   forces it to be placed in footer.
 * I’ve written to their support and hopefully they’ll be able to help me out.

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

The topic ‘javascript won't load in header’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [keligijus](https://wordpress.org/support/users/keligijus/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/javascript-wont-load-in-header/#post-5996950)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
