How to Fix WordPress ‘jQuery is not defined’ Error
Yuhda Ibrahim
Development Consultant
December 10, 2025
4 min read
Introduction
When running a WordPress website, you might have stumbled upon the frustrating “jQuery is not defined” error. This common issue often breaks features like sliders, forms, and interactive elements, making your site look broken or incomplete. If you’ve seen this error message in your browser’s console and wondered what went wrong, you’re not alone.
The error usually occurs because your site is trying to use jQuery before it’s properly loaded, or there’s a conflict between themes, plugins, or scripts. The good news? It’s not as scary as it sounds. With a few straightforward steps, you can troubleshoot and fix it yourself, no advanced coding skills required.
In this article, we’ll walk through why the “jQuery is not defined” error happens in WordPress, how to diagnose the problem, and practical solutions to get your site back to normal.

What Does “jQuery is not defined” Mean?
jQuery is a popular JavaScript library that powers many interactive features on WordPress sites. The error appears when your website’s code tries to run jQuery before it’s available. In simple terms: your site is asking for a tool that hasn’t been loaded yet.
You might see this error in your browser’s developer console when debugging issues like:
- Dropdown menus not working
- Image sliders freezing
- Forms not submitting
- Interactive elements failing
Recognizing this error is the first step toward fixing it.
Why Does the Error Happen in WordPress?
Several reasons can trigger the “jQuery is not defined” message. The most common include:
- jQuery not enqueued properly – WordPress has its own way of loading scripts, and skipping it can cause issues.
- Theme or plugin conflicts – Outdated or poorly coded plugins might load their own jQuery versions incorrectly.
- Scripts loading in the wrong order – If a script tries to use jQuery before it’s loaded, the error pops up.
- Using CDN or external scripts – Sometimes a CDN link is broken or blocked, preventing jQuery from loading.
- Migration issues – Moving your site or updating WordPress can sometimes break script references.
Knowing the cause helps narrow down the fix.
How to Fix WordPress ‘jQuery is not defined’ Error
Let’s go step by step through the most effective fixes.
1. Make Sure jQuery is Enqueued Correctly
WordPress comes with a built-in jQuery library. Instead of manually adding scripts, you should enqueue it properly in your theme’s functions.php:
function load_jquery_properly() {
if (!is_admin()) {
wp_enqueue_script('jquery');
}
}
add_action('wp_enqueue_scripts', 'load_jquery_properly');
This ensures WordPress loads jQuery the right way and prevents conflicts.
2. Place Scripts in the Footer
If your scripts run before jQuery loads, move them to the footer. When enqueuing, set the $in_footer parameter to true:
wp_enqueue_script('custom-script', get_template_directory_uri() . '/js/custom.js', array('jquery'), null, true);
This makes sure jQuery loads first, avoiding the undefined error.
3. Check for Plugin Conflicts
Plugins often load their own scripts, which can clash with WordPress. To test:
- Deactivate all plugins
- Reactivate them one by one
- Check the console for errors
If one plugin is the culprit, update or replace it with a more compatible alternative.
4. Update WordPress, Theme, and Plugins
Outdated versions of WordPress or plugins may load jQuery incorrectly. Regular updates help ensure compatibility with the latest jQuery library.
Go to:
Dashboard → Updates → Select all and update
5. Use the jQuery Migrate Plugin (Temporary Fix)
If the error appears after a WordPress update, some old themes or plugins might rely on deprecated jQuery functions. Install the plugin Enable jQuery Migrate Helper, which restores backward compatibility.
⚠️ Note: This is only a temporary solution. You should still update your theme or plugin to remove outdated code.
6. Double-Check CDN Links
If your site loads jQuery from Google’s CDN or another external source, make sure the URL is correct and not blocked by your hosting or browser settings.
A typical working CDN link looks like:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
If broken, switch back to WordPress’s built-in jQuery.
7. Use Browser Console to Debug
Open your browser’s developer tools (Right-click → Inspect → Console) and reload the page.
Look for:
- “jQuery is not defined”
- Which script is failing
- Whether the error disappears when scripts are disabled
This helps pinpoint the exact cause.
Preventing Future “jQuery is not defined” Errors
To avoid running into this issue again:
- Always enqueue scripts properly instead of hardcoding them.
- Keep WordPress, plugins, and themes up to date.
- Test new plugins in a staging environment before using them on your live site.
- Stick to well-coded plugins from trusted developers.
A little maintenance goes a long way toward preventing headaches later.
Wrapping It Up
The WordPress “jQuery is not defined” error might seem intimidating, but it’s usually caused by scripts loading in the wrong order, conflicts, or outdated code. By following the steps above—checking your enqueues, moving scripts to the footer, testing for plugin conflicts, and updating your site—you can fix the issue and restore full functionality.
Remember, while quick fixes like the jQuery Migrate plugin can help temporarily, the long-term solution is keeping everything up to date and following WordPress best practices.
If you’d like to dig deeper into WordPress troubleshooting, check out more of our guides to keep your site smooth and error-free.