I have noticed if I move all of my javascript to the footer, some plugins do not function properly, or at all. Is there some code I can add to my functions.php to move specific plugin javascript to the footer? Or is there a way to exclude certain js from going from the footer if I add it all?

This is the code I used:

remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);

function my_remove_thematic_scripts() {

add_action('init', 'my_remove_thematic_scripts'); //wait for init

//Add the actions to the footer

add_action('wp_footer', 'wp_print_scripts', 5);
add_action('wp_footer', 'wp_enqueue_scripts', 5);
add_action('wp_footer', 'wp_print_head_scripts', 5);

The plugins that don't work properly are simplemap, gravity forms (mainly not loading properly) and a background slider for my homepage.

  • please edit your question and add the code you are using to accomplish this. also give some specific examples of what plugins break by doing this.
    – Milo
    Apr 7, 2013 at 5:00
  • That is the code I was using that I found on a forum somewhere.
    – Sam
    Apr 7, 2013 at 6:26
  • Edit: simplemaps plugin loads on the page but no map or anything shows up. I'm using gravity forms all throughout the site and it seems to be either ignoring some of my css or reverting back to it's own. The last thing I see happening is my full homepage background slider is no loner rotating at all. Any help here is much appreciated. It's late, I'm a little tired so I hope that explained what I was trying to say.
    – Sam
    Apr 7, 2013 at 9:53

1 Answer 1


It is generally not recommended to put move javascript files to the footer, especially WordPress dependencies. WordPress and plugins require and expect dependencies to be in the header and things can go awry if they aren't. There are workarounds for this, but in many cases if you do move things to the footer and a plugin breaks, the developers won't support it.

  • 7
    it is not expected or a requirement for javascript to be in the header. the wp_enqueue_script function has an option for placing js in the footer and any properly coded theme or plugin should be able to function correctly in this case.
    – Milo
    Apr 7, 2013 at 5:05
  • 5
    WordPress and plugins require and expect dependencies to be in the header this is plain wrong!
    – Bainternet
    Apr 7, 2013 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.