You Are Here: Home » How-To » Programming

How To Remove WordPress Jquery Scripts From Header?

By on March 17th, 2012 
Advertisement

If you have already used WordPress then you must be familiar that a Jquery script is included by default in your blog pages headers. However, this version of jQuery included is always pretty old as compared to the latest versions released by the jQuery project. So if you want to get rid of this jQuery which is included by default, here is how you can:

Just add this code snippet to your WordPress theme's functions.php file and you are done:

wp_deregister_script('jquery');

However, this would also remove jQuery from your WordPress installation's admin panel rendering your WordPress installation totally unusable. In order to prevent that, just use this code snippet in your theme's functions.php file:

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

Now that the WordPress version of jQuery has been removed from your site, you need to drop in the latest jQuery script in your theme's header.php file, which can be done in two ways:

  • Either download jQuery from the official site and include it in your theme's header.php file
  • Or, use this snippet and paste it in your theme's header.php file:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

Advertisement



Related Posts by Tags: , ,





How To Remove WordPress Jquery Scripts From Header? was originally published on Digitizor.com on March 17, 2012 - 12:01 am (Indian Standard Time)