Severely Over Complicated jQuery Load Process

I have seen a lot of ways to load custom versions of jQuery, but this is probably the most “robust”, though I don’t mean that in a good way.

WordPress makes it really easy to load jQuery by simply doing:

wp_enqueue_script( 'jquery' )

Some developers believe it is better to force WordPress to use other versions of jQuery from google (or elsewhere). This is a practice I strongly disagree with. You can read about why I feel this practice is really irresponsible on Pippin’s Plugins.

Anyhow this particular developer went really far and decided to build an overly complex system for loading a custom version of jQuery, and all for a really simple tabs / accordion plugin. Here it is:

Now, I really do not like talking badly of others, so please note that I am NOT criticizing this developer personally. It is very likely that this was developed due to his or her own experiences and frustrations with the all-to-common jQuery conflict. I’m posting this not as a insult to whoever wrote this, but as an example of why theme and plugin developers should almost never load their own jQuery. The practice of loading jQuery from Google has resulted in developers needing to find elaborate solutions like this, when really it’s way simpler: if everyone did it correctly by just allowing WordPress to handle the version of jQuery loaded, we’d never have these problems.

Submitted by Josh Feck.

Advertisements

One thought on “Severely Over Complicated jQuery Load Process

  1. Looks like they didn’t take into account the admin area either that WP is preventing meddling of with jQuery.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s