
Encountering the $ is not a function error in WordPress can be frustrating, especially if you are not comfortable debugging code. This jQuery-related issue often appears when multiple scripts conflict or when the jQuery library is not loaded correctly. Understanding why $ is not a function occurs is the first step toward fixing it quickly.
Fortunately, solving the $ is not a function WordPress error does not require deep technical knowledge. By following simple troubleshooting steps such as checking theme scripts, resolving plugin conflicts, or ensuring proper jQuery loading, you can restore your site’s functionality and keep everything running smoothly.
What is the “$ is not a function” error?
This error occurs when jQuery, a popular JavaScript library, can’t recognize the $ symbol as a shortcut to call jQuery functions. This is often related to how jQuery works in WordPress, which uses compatibility mode to avoid conflicts with other JavaScript libraries.

Instead of using $, WordPress recommends using jQuery to be compatible with other scripts.
Why Does This Happen?
1. jQuery Conflict
WordPress runs jQuery in “no conflict” mode by default, which disables the familiar $ shortcut to prevent clashes with other libraries like prototype.js. This is one of the most common reasons you might see the $ is not a function error appear unexpectedly on your site.
2. Missing jQuery Dependency
If your theme or plugin is not properly enqueueing jQuery, scripts that rely on it will fail. When this happens, WordPress will often throw the $ is not a function message, signaling that the required library was never loaded in the first place.
3. Outdated or Missing jQuery Version
Using an older version of jQuery or removing it completely can cause critical functionality to break. Without the correct version, the $ shortcut cannot be recognized, which directly results in the $ is not a function problem across scripts on your website.
4. Inline Script Errors
Custom scripts placed inside a theme or plugin can break if they use $ without wrapping it inside a jQuery-ready function. This oversight leads to execution problems that confuse the system, resulting in the familiar $ is not a function message in your console.
5. Plugin or Theme Issues
Some plugins or poorly coded themes may introduce compatibility issues with jQuery. These conflicts often surface when scripts load in the wrong order, creating conditions where the $ shortcut is undefined, which then triggers the error and disrupts your site.
How to Fix “$ is Not a Function” in WordPress
1. Replace $ with jQuery
The easiest fix is to replace the $ shortcut with jQuery in your JavaScript code.
Example:
// Replace this
$(document).ready(function() {
console.log("Hello, World!");
});
// With this
jQuery(document).ready(function() {
console.log("Hello, World!");
});
2. Use a jQuery Wrapper
To use $ safe, wrap your code like this:
Example:
(function($) {
$(document).ready(function() {
console.log("Using $ safely!");
});
})(jQuery);
3. Enqueue jQuery
Make sure jQuery is loaded properly in your WordPress site by adding this code to your theme’s functions.php:
Example:
function load_custom_scripts() {
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'load_custom_scripts');
4. Update WordPress and Plugins
- Outdated software can cause compatibility issues. Update your WordPress core, theme, and plugins to the latest versions.
5. Use the jQuery Migrate Plugin
- If your site is using older jQuery features, install the Enable jQuery Migrate Helper plugin to restore compatibility while you fix the root cause.
6. Check for Conflicting Scripts
- Disable plugins one by one to find out which one is causing the conflict. Replace problematic plugins or contact the developer for support.
How to Prevent jQuery Errors in the Future
- Follow Best Practices: Always use jQuery instead of $ or wrap your code.
- Load jQuery Properly: Enqueue scripts via wp_enqueue_script() instead of hardcoding them.
- Avoid Inline Scripts: Put custom scripts in a separate file and enqueue them in WordPress.
- Test Often: Use a staging site to test updates or custom code before pushing them live.
FAQs
What does “$ is not a function” mean in WordPress?
When you see $ is not a function in WordPress, it means jQuery is running in noConflict mode. This disables the $ shorthand to avoid clashes with other JavaScript libraries. To fix it, you must adjust how your code references jQuery.
How do I fix “$ is not a function” in WordPress?
To fix the $ is not a function error, replace $ with jQuery or wrap your custom code inside a jQuery function. This ensures compatibility with WordPress’s noConflict mode and prevents scripts from breaking due to improper shorthand usage.
Do I need to install jQuery in WordPress?
No, you do not need to install jQuery separately. WordPress includes it by default, but the error $ is not a function may appear if your theme or plugin fails to properly queue it. Always verify correct enqueueing in your functions.php file.
Can plugins cause this error?
Yes, plugins can definitely trigger the $ is not a function error. Poorly coded plugins often load scripts incorrectly or conflict with jQuery. The best way to identify the culprit is by disabling plugins one by one until the error disappears.
What is jQuery noConflict mode?
In WordPress, jQuery noConflict mode prevents $ from being used as a shorthand, avoiding collisions with other JavaScript libraries. When developers see the $ is not a function issue, it often relates to this setting, and fixing it requires updating script usage.
End
The “$ is not a function” error in WordPress may seem scary, but with a little understanding of jQuery and WordPress scripting, it’s easy to fix. Follow the steps above and you’ll be error-free.
Be proactive, keep your WordPress environment up to date, and follow best practices, and you’ll never see this error again.

Leave a Reply