Encountering issues in WordPress can be frustrating, especially when the error message is unclear. One common problem is the ‘jQuery is not defined’ error.
This error can disrupt various features, from contact forms to image sliders, often catching users by surprise, particularly if they are not monitoring the browser console.
We have assisted numerous website owners in resolving this specific issue, and the great news is that you don’t need to be a developer to implement the solutions.
In this comprehensive guide, we will clarify the meaning of the error, explain its causes, and provide you with easy-to-follow, step-by-step solutions that anyone can execute, even without coding experience.
What Leads to the ‘jQuery is not defined’ Error?
jQuery is a popular JavaScript library utilized in WordPress to enable various interactive elements. However, it can sometimes fail to load properly, impacting your website’s performance.
The error can be found in the developer tools under the Console tab, which means many users might overlook it until they notice a functionality issue on their site.
Encountering the ‘jQuery is not defined’ error indicates that WordPress is struggling to load jQuery correctly. Throughout the years, we have assisted numerous users in resolving this issue, which typically arises from several common factors.
- Outdated Themes or Plugins: Many users face this error when their themes or plugins are not updated to align with the latest version of WordPress. This often occurs following significant WordPress updates.
- Improper Script Loading: jQuery needs to be loaded before any other JavaScript files. If it isn’t, scripts that rely on jQuery will fail to function. This issue frequently arises when themes or plugins do not correctly enqueue scripts.
- JavaScript Conflicts: Other scripts running on your website may clash with jQuery, particularly if they are not loaded correctly. Such conflicts can disrupt jQuery’s functionality, leading to the error.
- CDN Failures: Some websites depend on jQuery hosted on a Content Delivery Network (CDN). If the CDN is down or inaccessible, the website will be unable to load jQuery, resulting in the error.
All of these issues can hinder jQuery from functioning properly. However, with our expertise, we can guide you through the necessary solutions to resolve the problem.
How to Resolve the ‘jQuery is Not Defined’ Error
There are multiple effective solutions to address the ‘jQuery is Not Defined’ error when it arises. Below are the most reliable methods we have found to resolve this issue.
We suggest trying these strategies in the recommended order, but feel free to use the jump links below if you prefer to start with a specific method:
- Update WordPress, Themes, and Plugins
- Verify Proper Loading of jQuery
- Implement a jQuery Fallback
- Adjust Script Loading Order (Advanced)
- Modify wp-config.php to Resolve jQuery Loading Problems
- Obtain Premium Support for Assistance with the Error
- Frequently Asked Questions About the ‘jQuery is Not Defined’ Error
- Additional Resources: Troubleshooting WordPress Errors
We will discuss each of these methods in detail and provide you with extra resources for troubleshooting WordPress errors. Let’s dive in!
1. Update WordPress, Themes, and Plugins
Outdated software is a common reason for the ‘jQuery is Not Defined’ error. Themes or plugins that are not updated may be incompatible with the latest version of WordPress, leading to script conflicts. To resolve this:
First, make sure your WordPress core is up to date. Go to Dashboard » Updates and click ‘Update to version X.X.X’ if an update is available.
Explore our comprehensive guide on safely updating WordPress to the latest version for detailed instructions.
Your updates for WordPress plugins will appear below the core update section.
You can select all the plugins and click ‘Update Plugins’ to apply the updates.
Related Topics: A Step-by-Step Guide to Properly Update WordPress Plugins
Finally, you will find updates available for your WordPress themes.
Simply select all the themes and click ‘Update Themes’ to proceed.
If you have made customizations to your theme and are worried about losing them, refer to our guide on how to update your WordPress theme without losing your customizations.
2. Verify if jQuery Is Properly Loaded
Before diving into more complex solutions, it’s crucial to check if jQuery is correctly loaded on your site. This step will help you verify that jQuery is available and functioning properly.
To do this, simply right-click anywhere on your WordPress site and select ‘View Page Source.’
Tip: Alternatively, you can press Ctrl + U on Windows or Cmd + Option + U on Mac to view the page source.This action will display the raw HTML and JavaScript code for your page.
Next, press Ctrl + F (or Cmd + F on Mac) to open the search bar and type ‘jquery.min.js’ to locate it.
Next, press Ctrl +F (or Cmd + F on Mac) to bring up the search bar, and type ‘jquery.min.js.’
If jQuery is properly loaded, you should find a reference to it in the page’s source code.
You can also check for jQuery using your browser’s Inspect Tool. Just navigate to the ‘Network’ tab and refresh the page.
Helpful Tip: On a Windows computer, you can open the Inspect Tool by pressing F12. For Mac users, press Option + Cmd + I.
To filter the network activity, type ‘jquery’ in the search bar. If jQuery is loaded, it will appear in the list.
If jQuery is not visible through either method, the problem may lie in how it is enqueued in WordPress. The following steps will help you resolve this issue.
3. Implement a jQuery Fallback
Occasionally, a script on your website might load jQuery from a CDN that is experiencing connectivity problems. This can prevent jQuery from loading and trigger the error.
To resolve this issue, you can add a jQuery fallback to your WordPress site, ensuring that jQuery is always available.
You should include it in the head section of your site to guarantee it loads first. However, we advise against directly editing theme files, as changes may be lost during theme updates.
The optimal method for adding custom code in WordPress is by using the WPCode plugin. This code snippet manager allows you to insert custom code securely without risking your site’s functionality.
Begin by installing and activating the WPCode plugin. For step-by-step instructions, refer to our guide on how to install a WordPress plugin.
Important Note:A free version is also available, known as WPCode Lite.
After activation, navigate to Code Snippets » + Add Snippet. Next, click the ‘Use snippet’ button located under ‘Add Your Custom Code (New Snippet).’
In the code editor, assign a name to your snippet, such as ‘jQuery Fallback.’
Then, choose ‘HTML Snippet’ as the ‘Code Type.’
Now, paste the following code into the ‘Code Preview’ box:
')
Next, scroll down to the ‘Insertion’ section.
Here, you can specify where WPCode should load this code. Ensure you select ‘Site Wide Header.’
Finally, click the ‘Save Snippet’ button at the top to save your custom code.
After that, remember to activate the snippet by toggling it to ‘Active.’
4.Adjust Script Loading Order (Advanced)
A frequent cause of the ‘jQuery is not defined’ error is when jQuery loads after other scripts that depend on it. Correcting the script loading order ensures jQuery is always loaded first, avoiding conflicts.
If you identify which script depends on jQuery, you can properly enqueue that script by specifying jQuery as a dependency.
If the ‘jQuery is not defined’ error arises from jQuery loading after dependent scripts, you can resolve the script loading order using WPCode.
First, install and activate the WPCode plugin, or opt for the free version known as WPCode Lite.
Once activated, navigate toCode Snippets » + Add Snippetand click the ‘Use snippet’ button under ‘Add Your Custom Code (New Snippet).’
In the code editor, name your snippet something like ‘Fix Script Loading Order’ and select ‘PHP snippet’ as the code type.
Next, add the following code to ensure jQuery is enqueued as a dependency for any custom scripts:
wp_enqueue_script( 'your-script-handle', get_template_directory_uri() . 'js/your-script.js', array( 'jquery' ), null, true );
Make sure to substitute ‘your-script-handle’ with a descriptive name that identifies your script. Also, replace ‘/js/your-script.js’ with the actual name of your script file located in your theme’s /js/ directory.
The array('jquery') segment in the code guarantees that jQuery loads first.
After adding the code, navigate to the ‘Insertion’ options and select ‘Site Wide Header’ to ensure the script is placed correctly within your site’s HTML.
Finally, click the ‘Save Snippet’ button at the top to save your custom code changes.
Then, remember to activate the snippet by toggling it to ‘Active.’
Using WPCode to correctly enqueue scripts ensures that jQuery loads in the proper sequence. If this was the underlying issue, it should fix the error.
5. Modify wp-config.php to Resolve jQuery Loading Issues
If the previous methods have not resolved the issue, editing the wp-config.php file can assist in managing how WordPress loads scripts.
This approach is beneficial if the ‘jQuery is not defined’ error stems from script concatenation or file path problems.
Here’s how to implement this method:
First, access your wp-config.php file. You can access this file using an FTP client like FileZilla or through the file manager in your hosting control panel.
The wp-config.php file is found in the root directory of your WordPress installation, typically located in the public_html folder.
After locating the file, open it for editing and insert the following code just before the line that states /* That’s all, stop editing! Happy blogging. */:
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(FILE) . '/');
define('CONCATENATE_SCRIPTS', false);
Here’s what this code accomplishes:
- The
ABSPATHdefinition ensures that WordPress recognizes the correct path to its core files, which can help prevent jQuery loading problems. - The
CONCATENATE_SCRIPTSline disables the merging of scripts. This forces WordPress to load each script individually, avoiding conflicts that may occur when scripts are combined.
After adding this code, save your changes and refresh your site to check if the error has been fixed.
Disabling script concatenation can effectively resolve jQuery issues, particularly when other solutions fail.
6. Opt for Premium Support to Resolve the Error
If the previous solutions do not work, or if you prefer to have a professional handle the issue, consider our Premium WordPress Support services.
For a small one-time fee, you can enlist our expert WordPress engineers to resolve the error on your behalf.
By choosing our emergency services, you can avoid the stress of trying to fix the ‘jQuery is not defined’ error yourself.
This ensures that your website experiences minimal downtime, allowing you to quickly resume your online business activities.
Additionally, our emergency services do not require a contract, making it an ideal choice if you prefer not to commit to a full maintenance support plan.
However, we also provide comprehensive Maintenance Services if you wish to take a proactive approach to minimize the risk of website emergencies in the future.
Frequently Asked Questions About the ‘jQuery is not defined’ Error
What does the ‘jQuery is not defined’ error mean in WordPress?
This error indicates that jQuery was not loaded correctly on your website, which can cause features like sliders, forms, or menus to malfunction.
Is it safe to modify wp-config.php to resolve this issue?
Yes, it is safe as long as you carefully follow our instructions. We have tested this method, and it is a widely used solution for fixing script loading problems without risking your site’s functionality.
Will updating plugins and themes actually resolve this error?
In many instances, yes. We have observed that outdated themes or plugins can cause this error by failing to load jQuery properly or being incompatible with the latest version of WordPress.
What should I do if I’m not comfortable fixing this issue on my own?
You can take advantage of our Premium WordPress Support services, and we will take care of it for you. It’s a one-time solution with no ongoing contracts or monthly fees.
Additional Resources: Troubleshooting WordPress Errors
If the previous steps do not resolve your issue or if you wish to explore further, the following resources may be helpful:
- Beginner’s Guide to Troubleshooting WordPress Errors (Step-by-Step)
- How to Properly Add JavaScripts and Styles in WordPress
- The Most Common WordPress Errors and How to Fix Them
- How to Resolve Render-Blocking JavaScript and CSS Issues in WordPress
We trust this article has assisted you in resolving the ‘jQuery is not defined’ error in WordPress. Additionally, you might find our guide on updating jQuery to the latest version in WordPress useful, as well as our selection of top jQuery tutorials for beginners in WordPress.
If you enjoyed this article, consider subscribing to our YouTube Channel for WordPress video tutorials. You can also connect with us on Twitter and Facebook.


