Let Google serve your Wordpress theme.

Each WordPress version comes complete with the most latest versions of a number of JavaScript frameworks (coughjQuerycough). This is convenient for users taking advantage of the out-of-the-box capabilities of the latest install, but serving these files locally costs unnecessary bandwidth and slows page loading times.

A much better solution is to take advantage of a free CDN like Google’s AJAX Libraries. Even if a visitor doesn’t already have your library in cache from an earlier visit to another site, the odds are pretty good that Google will be serving your files more quickly than you could.

To put it into action, you’ll just need to add a few lines of code to your theme.

if(!is_admin()) {
  // serve jQuery from the Google AJAX API library
  wp_deregister_script( 'jquery' );
  wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', false, '1.4.4' );
}

Now when you enqueue jQuery or a dependent library, Google’s version will be served instead.

Let’s keep in touch

Reach out on Twitter or subscribe for (very) occasional updates.

Hey, I'm RJ: digital entomologist and intermittent micropoet, writing from the beautiful Rose City.