In the event you’re seeing the ‘jQuery isn’t outlined’ error to your WordPress admin house (or in different places), don’t fear – you’re no longer by myself. It is a not unusual factor that many WordPress customers stumble upon. That stated, it may be irritating when your web site doesn’t paintings as anticipated.

We’ve been running with WordPress for smartly over a decade, and all through that point, we’ve discovered tips on how to troubleshoot and get to the bottom of one of the crucial maximum not unusual WordPress mistakes. That incorporates the ‘jQuery isn’t outlined’ error.

On this information, we’ll talk about why this mistake happens and, extra importantly, tips on how to repair it. We’ll provide an explanation for the entirety in easy phrases, so although you’re no longer a developer, you’ll have the ability to practice alongside and get to the bottom of the issue briefly.

Fixing jQuery not defined  error in WordPress

What Reasons the ‘jQuery isn’t outlined’ Error?

jQuery is a extensively used JavaScript library in WordPress that is helping run many interactive options. Alternatively, every so often, it’ll fail to load accurately, which might impact the capability of your web page.

The mistake seems within the developer equipment beneath the Console tab, such a lot of customers would possibly not realize it till one thing breaks on their web site.

JQuery not defined error in the console

In the event you see the ‘jQuery isn’t outlined’ error, it way WordPress is having hassle loading it correctly. Through the years, we’ve helped numerous customers repair this factor, and we’ve discovered that it normally stems from a couple of not unusual reasons:

  1. Old-fashioned Subject matters or Plugins: Many customers stumble upon this mistake when their subject matters or plugins aren’t up to date to check the newest model of WordPress. We’ve steadily noticed this occur after main WordPress updates.
  2. Mistaken Script Loading: jQuery will have to be loaded earlier than different JavaScript information. If it’s no longer, scripts that rely on jQuery will ruin. This steadily happens if subject matters or plugins aren’t coded accurately to enqueue scripts​.
  3. JavaScript Conflicts: Different scripts operating in your web site might warfare with jQuery, particularly in the event that they’re no longer correctly loaded. This warfare can ruin jQuery, inflicting the mistake.
  4. CDN Disasters: Some websites depend on jQuery hosted on a Content material Supply Community (CDN). If the CDN is unavailable or blocked, the web site gained’t have the ability to load jQuery, ensuing within the error.​

All of those problems can save you jQuery from operating easily. However don’t fear – with our enjoy, we will information you throughout the answers to get to the bottom of the issue.

Repair the ‘jQuery isn’t outlined’ Error

There are a number of tactics to mend this mistake while you stumble upon it. Under are among the best strategies we’ve used to mend this drawback.

We propose checking out those methods so as, however you’ll use the leap hyperlinks under in case you’d like to begin with a specific one:

We’ll move over each and every of those strategies after which come up with some further assets for troubleshooting WordPress mistakes. Let’s get to it!

1. Replace WordPress, Subject matters, and Plugins

Old-fashioned instrument is likely one of the maximum not unusual reasons of the ‘jQuery isn’t outlined’ error. Old-fashioned subject matters or plugins is probably not appropriate with the newest model of WordPress, which may end up in script conflicts. To mend this:

First, make certain that your WordPress core is up to date. Navigate to Dashboard » Updates and click on ‘Replace to model X.X.X’ if an replace is to be had.

Update WordPress core

See our entire information on safely updating WordPress to a brand new model for extra main points.

Your WordPress plugin updates might be indexed under the core replace.

You’ll choose they all and click on ‘Replace Plugins.’

Installing WordPress updates

Finally, you’re going to see updates to your WordPress subject matters.

Merely choose they all and click on ‘Replace Subject matters.’

Update WordPress themes

In case you are involved concerning the adjustments you might have made in your theme, practice our information on tips on how to replace your WordPress theme with out shedding customizations.

2. Take a look at If jQuery Is Loaded Correctly

Prior to exploring extra complex answers, it’s necessary to test whether or not jQuery is in fact being loaded in your web site. This step is helping you verify whether or not the jQuery is to be had and functioning because it will have to.

Merely right-click any place in your WordPress web site and choose ‘View Web page Supply.’

Tip: On the other hand, you’ll press Ctrl + U on Home windows or Cmd + Choice + U on Mac to get entry to the web page supply.

This may display you the uncooked HTML and JavaScript to your web page.

View page source

Subsequent, press Ctrl +F (or Cmd + F on Mac) to carry up the quest bar, and sort ‘jquery.min.js.’

If jQuery is loaded accurately, you will have to see a connection with it within the code.

Search jQuery in source code

In a different way to search for jQuery is to make use of your browser’s Check out Device. Merely move to the ‘Community’ tab and reload the web page.

Tip: On a Home windows instrument, you’ll get entry to the Check out Device via urgent F12 in your keyboard. For Mac, hit Choices + Cmd + I.

Clear out the community process via typing ‘jquery’ within the seek bar. If jQuery is loaded, you’ll see it indexed right here.

Look for jQuery in Developer Tools

In the event you don’t see jQuery loaded in both approach, the problem is also the way it’s enqueued in WordPress. Within the following steps, we’ll information you thru solving this.

3. Upload a jQuery Fallback

Every so often, a script in your web site is also loading jQuery the usage of a CDN this is having connectivity problems. If that’s the case, it could fail to load jQuery and motive the mistake.

To mend the issue, you’ll upload a jQuery fallback in your WordPress web site. This guarantees that jQuery is at all times loaded.

You wish to have so as to add it in your web site’s head segment to verify it quite a bit first. Alternatively, we don’t suggest enhancing theme information without delay. We’ve noticed folks lose their adjustments when updating the theme and the code they added.

The easiest way to upload customized code in WordPress is to make use of the WPCode plugin. This is a code snippet supervisor that lets you upload customized code safely with out breaking your web site.

First, set up and turn on the WPCode plugin. For main points, see our instructional on putting in a WordPress plugin.

Be aware: There may be a loose model to be had referred to as WPCode Lite.

As soon as activated, move to Code Snippets » + Upload Snippet. Then, click on at the ‘Use snippet’ button beneath ‘Upload Your Customized Code (New Snippet).’

Within the code editor, give your snippet a reputation like ‘jQuery Fallback.’

After that, choose ‘HTML Snippet’ for the ‘Code Kind.’

Add your custom code

Subsequent, paste the next code within the ‘Code Preview’ field:


')

Then, scroll right down to the ‘Insertion’ segment.

Right here, you’ll inform WPCode the place to load this code. Just be sure you choose ‘Web page Huge Header.’

Load code site wide header

In spite of everything, click on the ‘Save Snippet’ button on the most sensible to save lots of your customized code.

After that, don’t put out of your mind to turn on the snippet via switching the toggle to ‘Lively.’

Save snippet

4. Repair Script Loading Order (Complicated)

Some other not unusual reason why for the ‘jQuery isn’t outlined’ error is that jQuery is loading after different scripts that depend on it. Solving the script loading order guarantees that jQuery is at all times loaded first, combating conflicts.

If you realize which script depends on jQuery, you’ll enqueue that script correctly via including jQuery as a dependency.

If the ‘jQuery isn’t outlined’ error is led to via jQuery loading after different scripts that rely on it, you’ll repair the script loading order the usage of WPCode.

First, set up and turn on the WPCode plugin, or opt for the loose model referred to as WPCode Lite.

As soon as activated, move to Code Snippets » + Upload Snippet and click on at the ‘Use snippet’ button beneath ‘Upload Your Customized Code (New Snippet).’

Within the code editor, give your snippet a reputation like ‘Repair Script Loading Order’ and choose ‘PHP snippet’ as your code kind.

Then, upload the next code to verify jQuery is enqueued as a dependency for any customized scripts:

wp_enqueue_script( 'your-script-handle', get_template_directory_uri() . '/js/your-script.js', array( 'jquery' ), null, true );

Don’t put out of your mind to switch ‘your-script-handle’ with a significant identify to spot the script. And change the ‘/js/your-script.js’ with the real script record identify to your theme’s /js/ folder.

The array('jquery') section within the code guarantees that jQuery is loaded first.

After getting added the code, scroll right down to the ‘Insertion’ choices and choose ‘Web page Huge Header’ to ensure the script is loaded in the proper a part of your web site’s HTML.

Load code site wide header

In spite of everything, click on the ‘Save Snippet’ button on the most sensible to save lots of your customized code.

After that, don’t put out of your mind to turn on the snippet via switching the toggle to ‘Lively.’

Save snippet

The usage of WPCode to correctly enqueue scripts guarantees jQuery is loaded in the proper order. If that was once the problem’s root, this will have to get to the bottom of the mistake.

5. Edit wp-config.php to Repair jQuery Loading Problems

If the opposite strategies haven’t labored, enhancing the wp-config.php record can assist via controlling how WordPress handles script loading.

This technique is beneficial if script concatenation or record trail problems are inflicting the ‘jQuery isn’t outlined’ error.

Right here’s tips on how to observe this system:

First, get entry to your wp-config.php record. You’ll do that the usage of an FTP shopper like FileZilla or via having access to the record supervisor to your web hosting keep an eye on panel.

The wp-config.php record is positioned within the root listing of your WordPress set up (normally within the public_html folder).

If you’ve positioned the record, open it for enhancing and upload the next code simply earlier than the road that claims /* That’s all, prevent enhancing! Glad running a blog. */:

/** Absolute trail to the WordPress listing. */
if ( !outlined('ABSPATH') )
outline('ABSPATH', dirname(FILE) . '/');
outline('CONCATENATE_SCRIPTS', false);

Right here’s what this code does:

  • The ABSPATH definition guarantees that WordPress is aware of the proper trail to its core information, which will save you jQuery loading problems.
  • The CONCATENATE_SCRIPTS line disables script concatenation. This forces WordPress to load each and every script one at a time, combating conflicts that rise up when scripts are merged.

After including this code, save your adjustments and reload your web site to look if the mistake has been resolved.

Disabling script concatenation is usually a easy however efficient repair for jQuery problems, particularly when different strategies don’t paintings.

6. Get Top class Beef up to Repair the Error for You

If not one of the above strategies paintings or you may merely relatively have knowledgeable check out your factor, then you definitely will have to imagine the usage of our Top class WordPress Beef up products and services.

Emergency WordPress Support

For a small one-time charge, you’ll rent our extremely professional, skilled WordPress engineers to mend the mistake for you.

When you select our emergency products and services, you gained’t must care for the effort of looking to repair the ‘jQuery isn’t outlined’ error by yourself.

This manner, your web site will enjoy minimum downtime, and you’ll resume your enterprise operations once imaginable.

Plus, our emergency products and services gained’t lock you into a freelance, so it may be an excellent choice in case you aren’t excited about a full-blown repairs beef up plan.

That stated, we do be offering extra complete Repairs Services and products if you wish to take a extra proactive method and cut back the chance of web page emergencies one day.

Bonus Sources: Troubleshooting WordPress Mistakes

If all of the above steps don’t assist otherwise you wish to learn additional, then the next assets might be excellent beginning issues:

We are hoping this text helped you repair the ‘jQuery isn’t outlined’ error in WordPress. You might also wish to see our information on upgrading jQuery to the newest model in WordPress or our select of the most productive jQuery tutorials for WordPress freshmen.

In the event you preferred this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You’ll additionally to find us on Twitter and Fb.

The submit Repair WordPress ‘jQuery isn’t outlined’ Error (6 Techniques) first gave the impression on WPBeginner.

WordPress Maintenance

[ continue ]