Title: Javascript files not being loaded
Last modified: August 19, 2016

---

# Javascript files not being loaded

 *  [sid17](https://wordpress.org/support/users/sid17/)
 * (@sid17)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/javascript-files-not-being-loaded/)
 * Hi all,
 * I am trying to load my JavaScript files in the footer of my page but having difficulty
   doing so.
 * I have the following function in my functions.php file but JQuery always gets
   loaded in the header even though I’ve set the in_footer flag to true.
 *     ```
       function load_jquery() {
       	if (!is_admin()) {
       		wp_deregister_script('jquery');
       		// load the Google API copy in the footer
       		wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', array(), '1.5.1', true);
       		wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', array(), '1.5.1', true);
       	}
       }
       add_action('init', 'load_jquery');
       ```
   
 * I have another function to load a plug in, this one does not get loaded at all;
 *     ```
       function load_myscript() {
       	if ( !is_admin() ) { // instruction to only load if it is not the admin area
          		// register your script location, dependencies and version
          		wp_register_script('myscript', get_bloginfo('template_directory') . '/js/myscript.js');
          		// enqueue the script
          		wp_enqueue_script('myscript', get_bloginfo('template_directory') . '/js/myscript.js', array(), false, true);
       }
       add_action('init', 'load_myscript');
       }
       ```
   
 * I’ve spent a lot of time trying to figure this out, I have the wp_footer() and
   wp_head() calls in the right places. I’ve read up on wp_register_script and wp_enqueue_script
   but did not find anything to help.
 * Sincerely appreciate any help.
 * Sid.

The topic ‘Javascript files not being loaded’ 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/)
 * [wp_register_script](https://wordpress.org/support/topic-tag/wp_register_script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [sid17](https://wordpress.org/support/users/sid17/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/javascript-files-not-being-loaded/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
