When I downloaded the latest version 3.8.1, inside wp-include/js there is a jQuery folder.

Can I assume that WordPress will always include it, meaning I don’t have to make my own call? E.g.

wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', array(), null, false); 
wp_enqueue_script('jquery'); 

3

Yes, jQuery is part of WordPress core. But–it can become outdated, because jQuery updates can happen in between WP releases. The recent release of WordPress does use a very recent version of jQuery.

By default,

wp_enqueue_script('jquery') 

grabs jQuery from the core at /wp-includes/js/jquery/jquery.js.

The “correct” way to add jQuery to your WP site is:

function theme_scripts() {
  wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'theme_scripts');

Another catch–if you do use the latest jQuery, be careful that it doesn’t break plugins.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *