Jquery – How to remove jquery from the frontside of the WordPress

jquerywordpress

My wordpress site is a bit heavy to download. On the frontend, its including jquery unnecessarily. In my firebug it looks like:

jquery.js?ver=1.3.2

and

jquery.form.js?ver=2.02m

I don't need these to be included for me.

I'm happy for them to remain in the wp-admin, but I'd like them not to load on the frontend.

I have found the file I think which is loading them in wp-includes/script-loader.php but I'm not sure what to uncomment out or what to do to remove it completely for the front.

Is there a way to do this, removing jquery without ruining the back end?

Best Solution

JQuery may be being added by your theme. If your theme is adding it properly, it should be using the wp_enqueue_script() function. To remove JQuery, simply use the wp_deregister_script() function.

wp_deregister_script('jquery');

Removing JQuery for your whole site might cause some unintended consequences for your admin section. To avoid removing JQuery on your admin pages, use this code instead:

if ( !is_admin() ) wp_deregister_script('jquery');

Now only pages that are not admin pages will run the wp_deregister_script() function.

Add this code to the functions.php file in your theme directory.