WpCode.net

Daily Wordpress Code Snippet

How to add jQuery from Google CDN

| 0 comments

Pin It

Pasting this code to your wordpress’s theme function.php file you could load the jquery library from Google Contend Delivery Network. By this way you can free your server from traffic. Continue reading

add_action( 'init', 'wpc_jquery_register' );
function wpc_jquery_register() {
if ( !is_admin() ) {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', ( 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' ), false, null, true );
    wp_enqueue_script( 'jquery' );
   }
}

Leave a Reply

Required fields are marked *.

*