I'm figuring out the ins and outs of WordPress. I know that WordPress sets some default filters and actions in /wp-includes/default-filters.php, but where does it register its scripts like jQuery? We are all able to set jQuery as a dependency or just enqueue it in our themes, but where does WordPress register it?

Any help would be much appreciated!

  • why does it matter (unless you just want to understand the internals)? – Mark Kaplun Apr 14 '16 at 8:22
  • 1
    Indeed, I just want to understand how WordPress works. :) – SomeCode Apr 14 '16 at 8:24

WordPress registers jQuery in the wp_default_scripts() function, which is found in wp-includes/script-loader.php.

// jQuery
$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.11.3' );
$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.11.3' );
$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.2.1' );
  • Awesome! That's exactly what I was looking for. Thanks a lot! – SomeCode Apr 14 '16 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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