PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Load google jquery api

  1. Hi.
    After reading your post today, I have become unsure of the way I load jquery in my themes.
    http://www.gravityhelp.com/gravity-forms-v1-6-4-2-released/. (By the way, I tried to post a comment on that page, but my comment was not submitted).
    I have always loaded jQuery from Google's API, because I wanted to use the latest version at the time of developing the site, plus I thought there were some speed advantages in doing so. I might be very wrong. :-)

    This is how I do it:

    add_action( 'wp_enqueue_scripts', 'load_javascript_files' );
    /**
    * Load scripts
    */
    function load_javascript_files() {
    	if (!is_admin()) {
    
    		wp_deregister_script('jquery');
    
    		wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', false, '1.7.2', false);
    		wp_enqueue_script('jquery');
    
    	}
    }

    Do you advice not to do this or what is your opinion on this method?

    Thanks
    Vayu

    Posted 11 years ago on Tuesday May 8, 2012 | Permalink
  2. I just saw that Carl answered this indirectly in a thread on another site here:
    http://wpcandy.com/teaches/how-to-load-scripts-in-wordpress-themes#comment-517876

    Thank you Carl for elaborating on this. It makes a lot of sense. I never thought of the complications it can cause.

    Vayu

    Posted 11 years ago on Wednesday May 16, 2012 | Permalink