jQuery is not defined is one of the most common JavaScript errors and it can make things stop working on your WordPress website. Here how it does look like in your browser console.
WordPress Reference Error is not defined : Fix jQuery is not defined
WordPress Reference Error is not defined : How to Fix
Common Causes:
- One of yours plugins’ JavaScript files are not properly loaded.
- Some JavaScript is running before the page is fully loaded, and as such, before jQuery is fully loaded.
- Your CDN-hosted jQuery might be blocked or down.
How to Fix?
Sometimes it will be too complicated to find the root of the issue, as you may not be able to find the culprit plugin, theme or the function that causes that issue. jQuery is not defined issue also could happen due to incompatibility between plugins and themes, snap! In such cases, it’ll be such a pain in the..!
Method 1
Add this line to your wp-config.php file:
Method 2
If method 1 (which is recommended) does not work, the other way to fix this issue is by adding the jQuery library directly to your theme header.php file by following these steps:
- Get the latest version of jQuery Library from Google Hosted Libraries
- Open your theme’s header.php file
- Paste what you got in the first step just after the head tag.
- Save your file.
Conclusion:
What we discussed here is not the optimal solution for fixing jQuery is not defined issue. As we mentioned, it can be too complicated to find the exact cause of the problem, so you can consider this as a quick workaround.
Leave a Comment
You must be logged in to post a comment.