WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 have the following in my functions.php and it doesn't seem to load jQuery. If I remove the wp_deregister_script() line it appears to load the wordpress included jQuery and not the one I have manually registered (that I can tell). Anyone have any ideas why this would be happening?

function register_scripts() {


        wp_register_script('jquery', 'http://code.jquery.com/jquery-1.7.min.js', '1.7', 1);
        wp_register_script('modernizr', get_bloginfo('template_directory').'/js/libs/modernizr-2.0.6.min.js', 'jquery');    
        wp_register_script('plugins', get_bloginfo('template_directory').'/js/plugins.js', 'jquery', '', 1);    
        wp_register_script('custom', get_bloginfo('template_directory').'/js/script.js', 'jquery', '', 1);



    add_action('init', 'register_scripts');
share|improve this question
It appears to be a load order issue. I think it has been fixed but would be interested if anyone could explain this to me? – Craig Nov 9 '11 at 0:48

When setting your dependencies they need to be in an array.

wp_register_script('jquery', 'http://code.jquery.com/jquery-1.7.min.js', '1.7', 1);
wp_register_script('modernizr', get_bloginfo('template_directory').'/js/libs/modernizr-2.0.6.min.js', array('jquery') );    
wp_register_script('plugins', get_bloginfo('template_directory').'/js/plugins.js', array('jquery'), '', 1);    
wp_register_script('custom', get_bloginfo('template_directory').'/js/script.js', array( 'jquery') , '', 1);
share|improve this answer
I don't think they need to be in an array unless you have more than one dependency. – Craig Jul 24 '12 at 19:07

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.