Skip to content

Instantly share code, notes, and snippets.

@maxrice
maxrice / wp-jquery.php
Created August 1, 2012 18:47 — forked from chrisguitarguy/wp-jquery.php
Maybe load jQuery from the google cdn
add_action( 'init', 'maybe_load_jquery_from_google', 1 );
function maybe_load_jquery_from_google() {
// do not load in wp-admin
if( is_admin() )
return;
// Load from SSL if necessary
$protocol = is_ssl() ? 'https:' : 'http:';
$url = $protocol . '//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js';