Snippet: Loading jQuery from the Google CDN

CDN Content Delivery network is the most reliable way to getting content from internet, then why not add jQuery from CDN.

Add following code to “functions.php”


add_action( 'init', 'jquery_register_google_cdn' );
function jquery_register_google_cdn() {
    if ( !is_admin() ) {
        wp_deregister_script( 'jquery' );
         // register from google and for footer
        wp_register_script( 'jquery', ( '' ), false, null, true );
        wp_enqueue_script( 'jquery' );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>