1

What do you think of killing jQuery in the public facing WP site? Isn't it useless and making for slower page loading? What's the best way to get rid of it?

1
  • Are you actually having jQuery on your frontpage and ask this because you don't know wether or not to remove it? And bear in mind that your question can tend (not that it was meant to) to be highly subjective. Imagine someone who dislikes jQuery but prefers another javascript library - wordpress.stackexchange.com/faq -- anyway, you probably want to checkout the questions already given and to refine your question to make it more concrete.
    – hakre
    Nov 19, 2010 at 20:28

5 Answers 5

2

jQuery is loaded by the theme that you use and not by WordPress. The theme must be modified to not load jQuery.

Useless? not sure. It is very useful. Many themes' UI elements and even design elements may depend on jQuery.

7
  • It's the other way around: jQuery is loaded and used by Wordpress for the admin UI; it may or may not be used by the theme, depending on if it is incuded by the theme designer. Nov 18, 2010 at 21:39
  • @songdogtech: I think that's what Raj was suggesting Mark... And hi, nice to see you here mate... ;)
    – t31os
    Nov 18, 2010 at 23:17
  • Yes, I meant to say that the inclusion of jquery is done by the theme and not WordPress. WordPress does ship with its own copy of WordPress that may be used by wordpress themes.
    – rsman
    Nov 19, 2010 at 2:21
  • WordPress ships with a copy of WordPress? I'm sure that wasn't intentional either, hehe... ;)
    – t31os
    Nov 19, 2010 at 11:49
  • Oops. Thats what no sleep does to you. :P
    – rsman
    Nov 19, 2010 at 13:44
2

jQuery is a library loaded on demand (either copy bundled with WordPress or from other server).

To remove it you first have to determine how is it getting added, which is most probably by theme or plugin. Proper way is usage of wp_enqueue_script() function, but many poorly coded themes/plugins can echo it directly and such.

In case of theme (that you are not going to update) you can simply edit code out. For theme or plugin that must be compatible with future updates you will need to remove script registration from API hooks - best case scenario. Worst case scenario that it won't be possible without editing files.

1

It's up to you whether you want to use jQuery in your site (on the public site) or not. It's a part of the theme.

So, it's your choice. The best way to get rid of it - simply don't include it in your theme.

What's the question here again?

1

If you're concerned about jQuery load time, use Google as a CDN: WordPress › Use Google Libraries « WordPress Plugins

1

WP doesn't add it.

If you're not loading jQuery yourself, odds are that your theme and plugins probably will. You want jQuery if it's around.

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.