WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently enque jQuery like so - how do I move this to the footer instead?

// Enque: jQuery
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
   wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
share|improve this question
Why do you need to move it to the footer? What are you trying to that requires you to deregister core's jquery? – Andrew Bartel May 2 '13 at 18:14
Why even replace the internal library? (with an older version mind you) Is there some special functionality that version provides that you need? Additionally you don't need that is_admin() check, that action doesn't run in the admin. – t31os May 2 '13 at 18:48
Also, the last param of both wp_enqueue_script and wp_register_script defines whether to load the script in the footer. – t31os May 2 '13 at 18:50
up vote 3 down vote accepted

The fifth parameter is $in_footer. You have left that out. Add that parameter, set it to true.

  "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js",

But I echo the concern expressed by @Andrew in a comment. You can cause yourself trouble by deregistering/replacing the core libraries.



share|improve this answer

wp_register_script() takes boolean for last argument $in_footer (default false) to achieve this.

Note that it is strongly considered best practice to use same version WP core uses (determined by code) rather than hardcode arbitrary one.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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