Whether you're a stranger to WordPress errors or not, being met with "jQuery is not divers" while working on your website is never fun. Information technology tin exist a startling and confusing message to see. Luckily, this is a standard fault that sites using jQuery may experience at some bespeak or another.

Perhaps your site is downwards, and when you bank check your browser panel for errors, you see "jQuery is non defined." Finding the fault is the offset step — so well done!

The adjacent step is to resolve it. Because this is one of the more straightforward JavaScript errors to fix, it shouldn't take you very long at all.

In this post, we'll walk you through everything y'all need to know to fix information technology fast. That includes what the mistake means, why it may take happened in the first place — all critical information to prevent this error in the futurity. Finally, nosotros'll walk you through a few steps you lot can accept to resolve it.

Allow'south dive in!

Check Out Our Video Guide to Fixing the "jQuery Is Not Defined" Mistake

What Is the "jQuery Is Non Defined" Error?

The handy console log in your browser is where yous'll probably discover this fault. But information technology's not incredibly descriptive. What does "jQuery is not divers" actually mean?

In plain English language, this fault is trying to tell you that something on your site — may be a plugin — requires jQuery to part on your site. For some reason, when the browser tried to load the website and called for that specific jQuery, it was not available.

This error can potentially shut downwardly your site to visitors. Considering roughly 78% of the websites on the internet run on jQuery, this is a common error to find.

The Chrome dev tools console tab will read "jquery is not defined" in red
jQuery is not defined" error in the panel log.

Whether you're a stranger to WordPress errors or not, being met with "jQuery is not defined" while working on your website is never fun. 😫 Larn how to gear up it here! ⬇️ Click to Tweet

Potential Causes of the "jQuery Is Not Defined" Error

This error can be quite a surprise. Your site was working only fine yesterday — what happened? This might be a scrap of a head-scratcher.

There are a few possible things that could have occurred that threw the "jQuery is not defined" fault:

  1. Old plugins installed on your WordPress site are conflicting with ones that you installed and activated more recently. If you recently installed or activated new plugins or some of the plugins on your site have not been updated recently, this may be the cause.
  2. A dull or poor-performing hosting surroundings could increment the corporeality of time it takes your jQuery to perform when called. Double-check your server resources or mistake log to confirm this.
  3. The JavaScript on your website is running earlier the jQuery is fully loaded. Or perhaps a JavaScript file is not being correctly loaded when the folio loads.
  4. The CDN that y'all're using to improve your site functioning was unable to reach your server. If y'all're non using a CDN at all, you can rule out this possibility entirely.
  5. There's an error or typo in your version of jQuery. Perhaps someone recently edited a core file or a plugin, which has now caused a disharmonize.

How To Fix the "jQuery Is Not Defined" Fault

Before we dive into the fix, remember to brand a fill-in of your website before editing code! Even the most seasoned developers make mistakes at present and again, and having a backup on hand will foreclose you from losing any important work every bit you troubleshoot.

If you have the option, resolve the mistake on a staging or development site first, as Kinsta customers practice, so confirm the fix and push those changes live.

In one case you've taken those necessary precautions, information technology'due south time to fix that error.

Resolving this error takes some familiarity with adding, removing, and editing code. Don't worry — you won't demand to write any code from scratch. Merely information technology would assistance if you lot were prepared to access your site'south code, either through SFTP or through your hosting environs.

It's not ideal for editing code through the WordPress dashboard code editor. If you don't already accept a skillful text editor handy, at present'south the time to install one.

Hither are a few options you lot can employ to resolve this fault and become your site back up to visitors.

Method 1: Use the Network Tab to Debug if jQuery Is Loading

Look at the Network tab of your browser's dev tools to encounter if jQuery is being loaded. This gives you one place to find a quick validation.

The alternative is looking through multiple plugins and themes that could be causing the fault. Go through the lawmaking of your site and ensure that jQuery is included. Information technology would be best if yous merely loaded it one time.

Subscribe At present

If the jQuery library isn't included, add it to your wp_enqueue_script() office with the following snippet:

wp_enqueue_script( 'tt-mobile-menu', get_template_directory_uri() .
'/js/mobile-menu.js', array('jQuery'), '1.0', true );

Locate this code by going to the wp-includes folder, then open the script-loader.php file. If this doesn't work, or if you lot notice that the jQuery library is, in fact, already included, move on to the following method.

Snippet can be pasted into any FTP editor, so long as it's in the script-loader.php file.
How your snippet volition look in the script-loader.php file.

Method ii: Brand Certain jQuery Is Loaded

You may experience the "jQuery is not defined error" when jQuery is included but non loaded. Make sure that it's loaded by finding the script source and pasting the URL in a new browser or tab.

For instance, if the <script src= is ready to this:

Your snippet of text should look like this in your code editor.
The snippet of text you should look for to find the URL to test.

Then, copy and paste the http://code.jquery.com/jquery-1.xi.ii.min.js portion into a new window or tab. If the jQuery file loads and shows you the unabridged contents, you tin can check this off your list.

Method three: Include Google-Hosted jQuery With a Local Fallback

This is a great option to include with your JavaScript because running jQuery on the localhost may meliorate your website experience overall. Information technology will assistance avoid whatsoever other CDN jQuery loading issues.

// Autumn dorsum to a local copy of jQuery
window.jQuery || document.write(''))

With the note at the beginning, this is what your snippet of code should look like.
This is what your lawmaking snippet should look similar in your code editor. Don't forget the note!

Method four: Add a Snippet to wp-config.php File

If none of the above work, open upwards the wp-config.php file and paste in the following snippet in its entirety:

/** Absolute path to the WordPress directory. */
if ( !divers('ABSPATH') )
ascertain('ABSPATH', dirname(__FILE__) . '/');
define('CONCATENATE_SCRIPTS', false);

Once added to the wp-config.php file, this is what your snippet will look like.
What the snippet will await like in your wp-config.php file.

Method 5: Insert the jQuery Library Manually

Equally a last method, you tin can go direct into the header.php file and add the jQuery library.

Hither's how:

  1. First, become to Google Hosted Libraries and copy the latest version of the jQuery library in its entirety.
  2. Open up your header.php file, establish in your themes folder.
  3. Add in the jQuery library from step one. Make sure it goes in right afterwards the head tag.
  4. Relieve the file when you're done.
Make sure this is what the snippet looks like in your wp-config.php file
What the snippet will look like in your wp-config.php file.

Practiced news- you've found the "jQuery is not defined" error. 🙃 Now it's time to solve it! ⬇️ Click to Tweet

Summary

And there y'all have it! After following these steps, yous should exist able to resolve the "jQuery is not divers" error and access your site.

Since this problem is typically due to the browser'south inability to connect with your jQuery library, there are a limited number of solutions you lot can effort. Most people detect success with whatever of the above options.

If none of the above steps have resolved the fault for some reason, information technology'due south a good idea to contact your hosting company for support.

Accept you encountered this error before? How did you solve it? Let us know in the comments section!


Save fourth dimension, costs and maximize site operation with:

  • Instant aid from WordPress hosting experts, 24/vii.
  • Cloudflare Enterprise integration.
  • Global audience accomplish with 29 information centers worldwide.
  • Optimization with our congenital-in Application Performance Monitoring.

All of that and much more, in ane plan with no long-term contracts, assisted migrations, and a xxx-solar day-money-back-guarantee. Check out our plans or talk to sales to find the plan that's right for you lot.