Beware WordPress Themes That Load jQuery

I recently worked on the WordPress website of a friend who was having issues with jPlayer not playing the music. We had recently moved her gigs calendar over to GigPress from some other, lesser event manager, and she thought maybe that migration had broken the music player. I didn't build her site initially, but I was pretty sure GigPress didn't have anything to do with it. It seems to be a plugin of pretty high quality, and a good citizen in the WordPress ecosystem.

Long story short, the custom theme running on her site was loading its own version of jQuery (strike 1) without using wp_enqueue_script() to make sure jQuery hadn't already been loaded (strike 2), which annoyed me, causing me to write a blog post (strike 3).

I love that WordPress empowers people to make their own websites without having to know gobs about how software works. I'm not such a fan of themes that are built without a healthy measure of looking to the future. WordPress has had jQuery built-in for years, and does a fairly good job of keeping that version up-to-date, or close to it. Including your own version is at best unnecessary, and at worst can cause a website to break down. Unfortunately, this happens in the world of commercial WordPress themes, where you might expect higher quality due to the exchange of many, as well as in free and custom themes.

If you're you're evaluating themes for your website, particularly if you're spending money and/or a lot of time on the process, this is one measure of quality you can look at. If the theme includes its own version of jQuery in the header.php or footer.php, doesn't use wp_enqueue_script() to handle jQuery inclusion and dependencies, it might be a good idea to look for something better.

Comments are closed on this post to keep spammers at bay. If you want to chime in, please email or send a tweet.