Most scripts (i.e. jQuery) are queued up by plug-ins that depend on them. Since jQuery ships with WordPress, it makes it really easy to distribute a lean, lightweight plug-in and just call the script from wp-includes/js
using wp_enqueue_script('jquery')
. In fact, this is the recommended way to include scripts on your site (not sure how you're using/choosing your own, but that's a secondary point).
To remove default scripts, you can use a similar call to: wp_deregister_script('jquery');
. This will remove the script named "jquery" from the queue and it will not be included. Here's the full code you'd place in your functions.php
file:
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
wp_deregister_script( 'jquery' );
}
Keep in mind, though, that some plug-ins might still depend on this script. When you register a script, you typically add any dependencies right in the registration ... so if a script depends on jQuery and you've removed it like this ... then you'll end up breaking the plug-in because other scripts won't be included on the page (even if you manually added jQuery through a <script></script>
tag on the site.
To avoid this, you'll need to use WordPress' registration/enqueuing engine to re-add your own version of jQuery:
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
wp_deregister_script( 'jquery' );
wp_enqueue_script( 'jquery', PATH_TO_YOUR_JQUERY_VERSION, '', '1.4.2');
}
This will re-add jQuery (I assume you're using version 1.4.2, but replace the version number there with whatever you're using) and queue it back up in the system. Then any dependencies should be satisfied and everything should work as expected.