Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
1  
jQuery loads when its called by theme or plugins. –  Sisir Nov 28 '11 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? –  Chip Bennett Nov 28 '11 at 20:47

2 Answers 2

up vote 6 down vote accepted

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!

share|improve this answer

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' );
share|improve this answer
    
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 '11 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 '11 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 '11 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 '11 at 15:16

Your Answer

 
discard

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.