Fix jQuery is not defined Error

PHP Code Snippets/Functions

The error message “Uncaught ReferenceError: jQuery is not defined” typically occurs when you’re trying to use jQuery in your code, but jQuery has not been properly included or loaded before your script.

To resolve this issue, you should ensure that jQuery is included and loaded before your script that depends on it.

To make sure that the jQuery is included, you can add this code to the function.php.

function enqueue_jquery() {
    wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'enqueue_jquery');

Leave a Reply

Your email address will not be published. Required fields are marked *