Title: moving scripts from header
Last modified: August 19, 2016

---

# moving scripts from header

 *  Resolved [Steven](https://wordpress.org/support/users/spstieng/)
 * (@spstieng)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/moving-scripts-from-header/)
 * I’ve added a few plugsins like SimplwViewer, Google Calendar and Image manager.
   When I looking at the HTML source, I discovered a lot of javascripts.
 * Having a lot of javascripts in the header is not good if you want to optimize
   the site for the search engines.
 * This code <?php wp_head(); ?> generates a lot of code, and most taken from plugins.
 * How can I alter this to have the <scripts> be displayed in the footer rather 
   in the header?
 * I have looked into general-template.php to see if I could discover anything. 
   The only thing I found was this:
 *     ```
       function get_header() {
       	do_action( 'get_header' );
       	if ( file_exists( TEMPLATEPATH . '/header.php') )
       		load_template( TEMPLATEPATH . '/header.php');
       	else
       		load_template( ABSPATH . 'wp-content/themes/default/header.php');
       }
       ```
   
 * Any suggestions anyone?

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

 *  [xamataca](https://wordpress.org/support/users/xamataca/)
 * (@xamataca)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/moving-scripts-from-header/#post-804749)
 * This has to do with plugins inserting their needed javascript to work.
    And the
   correct placement is between your <head> tags in header.php if they are linking
   to a .js file
 * Most won’t work if you put them in the footer.php, because the js scripts need
   to set vars and functions before call them inside the <body> tags. Another matter
   is if those plugins just fill the head with javascript code… I think that’s a
   problem with how the plugin is coded.
 * I’m not an expert in JS but probably you will get a proper explanation from someone
   with more knowledge.
 *  Thread Starter [Steven](https://wordpress.org/support/users/spstieng/)
 * (@spstieng)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/moving-scripts-from-header/#post-804877)
 * Yeah, call to .js scripts needs to be in the header.
    But actual javascripts 
   should be put in the footer if possible.
 * I’ll leave it be for the moment.
 * Thanks.
 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/moving-scripts-from-header/#post-804879)
 * > Having a lot of javascripts in the header is not good if you want to optimize
   > the site for the search engines.
 * …that’s crap.

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

The topic ‘moving scripts from header’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [whooami](https://wordpress.org/support/users/whooami/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/moving-scripts-from-header/#post-804879)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
