Fixing jQuery Problems in WordPress Websites

Lots of WordPress plugin developers use jQuery to help you add features to your website. It drives lightboxes, drop-down menus, sliders and forms plus lots of other elements, so what do you do when it breaks or stops working?

jQuery is a very popular language on the web these days. It’s fairly easy to learn and implement on your site and it can add a lot of functionality which makes your site more user-friendly and better looking! You can learn about it here on the jQuery website.

If you are using it (maybe to show elements hidden with your CSS) or have installed plugins that rely on it, there may be issues with multiple instances of it being loaded. You can get around this, by adding some code to your theme‘s functions.php file, to ‘enqueue’ jQuery:

// Load jQuery
if ( !is_admin() ) {
wp_register_script(‘jquery’, (“//”), false);

Here, we first ‘deregister’ jQuery to ensure that multiple copies aren’t already firing, then we register or load it using the Google jQuery script library. This is a good idea because lots of other sites seem to use this method and your visitors may already have it in their browser’s cache. Finally, we add jQuery to our queue so it is ready when needed.

Two other points that are worth noting:

  1. Keep your Google library version number as current as possible. This reduces possible problems as changes are made to any plugins you are using.
  2. When using your own jQuery script in a WordPress site, make sure to use ‘jQuery’ in full rather than the abbreviated ‘$’. Again, this limits conflicts. For example:



other page

What do you think?

It's good to talk!

Your email address will not be published. Required fields are marked *