How to Remove WordPress jQuery

07 September 2010 by Rick ~ 2 Comments 1909 views

If you want to speed up your WordPress site you should be using Google to host the common JavaScript libraries.

Remove the WordPress jQuery version and add the Google one.

Add the following lines to your functions.php (inside your template folder).

if ( !is_admin() ) {

 // First jQuery
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', false, '1.4.2', false ); // load in footer - true
        wp_enqueue_script( 'jquery' );
       
                // Now Prototype (if you're using it)
        wp_deregister_script( 'prototype' );
        wp_register_script( 'prototype', 'http://ajax.googleapis.com/ajax/libs/prototype/1.6.1/prototype.js', false, '1.6.1', false ); // load in footer - true
        wp_enqueue_script( 'prototype' );      


               // Removing more Scripts...
              wp_deregister_script( 'scriptaculous-effects' );
}

bbPress

This code can be also used in bbPress . You just need to replace the is_admin with bb_is_admin.

Subscribe by E-mail:

« »

2 Comments

  1. You can use

    bb_is_admin

    function in bbPress. ;)

     

Add a Comment

Use [code] example piece of code [/code] to insert code into your comment.