 <p><code>Answer</code> of @Mangesh Parte can be <strong>short</strong> like,</p> <pre><code>&lt;?php function load_external_jQuery() { wp_deregister_script( 'jquery' ); // deregisters the default WordPress jQuery $url = 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'; // the URL to check against $test_url = @fopen($url,'r'); // test parameters if( $test_url !== false ) { // test if the URL exists if exists then register the external file wp_register_script('jquery', $url); } else{// register the local file wp_register_script('jquery', get_template_directory_uri().'/js/jquery.js', __FILE__, false, '1.7.2', true); } wp_enqueue_script('jquery'); // enqueue the jquery here } add_action('wp_enqueue_scripts', 'load_external_jQuery'); // initiate the function ?&gt; </code></pre>