Skip to content

Disable jQuery from Loading in Custom Wordpress Template

May 18, 2010 1 min read #jquery #wordpress

This post is more than 18 months old. Technology changes quickly, so some of this content may be out of date (but that's not always the case). Please verify any technical or programming information against the current release.

On the rest of my site, I load jQuery from the google cdn. However, wordpress likes to load it from the local cache using wp_enqueue_script(). I didn’t want to delete the jQuery file it was loading because a) that would be wrong, b) it would still have to make a 404 call to the server, and c) the admin section uses it I’m sure.

Instead, I found there was a function called wp_deregister_script(). Using this, I removed the jquery from my header.php file - and continued to load it from the cdn. For reference, this is what I did:

<?php wp_deregister_script('jquery');wp_head(); ?>
php