3

I was told not to mess with the core files. Also, I don't want jQuery to load on every single page.

2
  • 1
    jQuery loads when its called by theme or plugins.
    – Sisir
    Nov 28, 2011 at 15:13
  • Who are "we"? What version of WordPress are you using? What Theme are you using? What jQuery-enqueueing Plugins are you using? Nov 28, 2011 at 20:47

2 Answers 2

6

Get rid of the plugin/theme that's causing jQuery to load :) jQuery is shipped with WordPress doesn't mean that it's loaded every time by default, it's being loaded by a theme or plugin that you're using. Look for a call to wp_enqueue_script :)

Good luck!

0

Most themes will, by default, include Jquery.

If you REALLY don't want it to load, put this in your Functions.php file (in the theme)

function my_scripts_method() {
    wp_deregister_script( 'jquery' );
}    

add_action('wp_enqueue_scripts', 'my_scripts_method');

Or find and put in comments (add // in front) these lines.

wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js');
wp_enqueue_script( 'jquery' );
4
  • If a theme/plugin is going to the trouble to register/enqueue a CDN version of jQuery, it probably needs it ... so don't comment that out. Also, if it's loading jQuery from Google's CDN it's probably cached already and won't impact the site's loading time at all.
    – EAMann
    Nov 28, 2011 at 16:37
  • That is if he REALLY doesn't want Jquery... Jquery is so universal right now that you pretty much don't lose anything having it in your code.
    – Fredy31
    Nov 28, 2011 at 16:39
  • 1
    The thing is, if you disable it and your site is trying to use it, you're intentionally breaking things. Don't just disable jQuery for the sake of disabling it.
    – EAMann
    Nov 28, 2011 at 17:14
  • 1
    Additionally the admin area relies on jQuery quite heavily, without conditional admin logic in the above you'll likely break or at least limit the administration pages functionality.
    – t31os
    Nov 29, 2011 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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