{"id":64895,"date":"2022-09-27T19:27:35","date_gmt":"2022-09-27T19:27:35","guid":{"rendered":"\/tutorials\/?p=64895"},"modified":"2026-03-09T19:18:26","modified_gmt":"2026-03-09T19:18:26","slug":"wordpress-jquery-is-not-defined","status":"publish","type":"post","link":"\/ng\/tutorials\/wordpress-jquery-is-not-defined\/","title":{"rendered":"WordPress jQuery is not defined Error: 4 effective ways to fix it"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Around 80% of all websites are running on jQuery &ndash; if your WordPress site is one of them, you might encounter the &ldquo;Uncaught ReferenceError: jQuery is not defined&rdquo; error at some point. This error message indicates that your site can&rsquo;t call a function from the jQuery JavaScript library, causing one or multiple website elements to stop running.<\/p><p>Fortunately, there are multiple ways to fix this common error. In this article, we will go through four methods to do so for WordPress users.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Mega-WordPress-Cheat-EN.pdf\">Download all-in-one WordPress cheat sheet<\/a><\/p><p>\n\n\n\n<div class=\"protip\"><div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                   What Is the jQuery Is Not Defined Error?\n                <\/p>\n            <\/div>\n            <p class=\"protip__content\"> jQuery is not defined&rdquo; is a common WordPress error that occurs when a website calls for a jQuery function before the library properly loads. Possible causes include conflicting plugins, a corrupted jQuery file, a blocked CDN, or your JavaScript code loads incorrectly.&rdquo;<br>\n<\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-common-causes-of-the-jquery-is-not-defined-error\">Common Causes of the jQuery Is Not Defined Error<\/h2><p>Here are several possible causes that can trigger the &ldquo;Uncaught ReferenceError: jQuery is not defined&rdquo; error on your WordPress website:<\/p><ul class=\"wp-block-list\">\n<li><strong>Conflicting plugins.<\/strong> A recently installed or activated plugin might have a jQuery variable that conflicts with one of your old plugins. Not using the latest version of your plugins could also cause the jQuery error.<\/li>\n\n\n\n<li><strong>Blocked CDN-hosted jQuery.<\/strong> If you&rsquo;re using a CDN-hosted jQuery like the Google Hosted Libraries, it might be down or blocked from reaching your server due to the huge number of requests.<\/li>\n\n\n\n<li><strong>Corrupted jQuery file.<\/strong> This is usually the case when downloading a file from an unreliable website.<\/li>\n\n\n\n<li><strong>JavaScript runs incorrectly.<\/strong> Your JavaScript runs before the jQuery code is fully loaded, causing your website to call for functions that haven&rsquo;t been defined yet.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-4-methods-to-fix-the-jquery-is-not-defined-error\">4 Methods to Fix the jQuery Is Not Defined Error<\/h2><p>Now that you understand how the &ldquo;Uncaught ReferenceError: jQuery is not defined&rdquo; error occurs, it&rsquo;s time to <a href=\"\/ng\/tutorials\/debug-wordpress\/\">debug your WordPress website<\/a>. In this section, we will show you four solutions to fix this issue.<\/p><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> Don&rsquo;t forget to <a href=\"\/ng\/tutorials\/backup-wordpress\/\">backup your website<\/a> before debugging the site to avoid losing important data in case of an error.\n            <\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-1-add-a-snippet-to-the-wp-config-php-file\">1. Add a Snippet to the wp-config.php File<\/h3><p>The first and most effective way to fix the &ldquo;jQuery is not defined&rdquo; error is to define the file path (ABSPATH) in the WordPress core file. Insert the following snippet to the <a href=\"\/ng\/tutorials\/wp-config-php\/\">wp-config.php<\/a> file through a File Manager or an FTP client like FileZilla:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/** Absolute path to the WordPress directory. *\/\nif ( !defined('ABSPATH') )\ndefine('ABSPATH', dirname(__FILE__) . '\/');\ndefine('CONCATENATE_SCRIPTS', false);<\/pre><h3 class=\"wp-block-heading\" id=\"h-2-include-google-hosted-jquery-with-an-alternate-fallback\">2. Include Google-Hosted jQuery With an Alternate Fallback<\/h3><p>Setting a fallback helps to solve CDN loading issues. If your chosen CDN is unavailable, your server can run the cached version of jQuery to keep the site functioning normally.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Fall back to a local copy of jQuery if the CDN fails\n&lt;script&gt;\nwindow.jQuery || document.write('&lt;script src=\"http:\/\/mysite.com\/jquery.min.js\"&gt;&lt;\/script&gt;'))\n&lt;\/script&gt;<\/pre><h3 class=\"wp-block-heading\" id=\"h-3-add-the-jquery-library-manually\">3. Add the jQuery Library Manually<\/h3><p>If the previous methods don&rsquo;t fix the jQuery error, try adding the jQuery library to your <strong>header.php<\/strong> file. You can do this through your WordPress host. Here&rsquo;s how to do it using Hostinger&rsquo;s File Manager:<\/p><ol class=\"wp-block-list\">\n<li>Go to the <a href=\"https:\/\/developers.google.com\/speed\/libraries\">Google Hosted Libraries<\/a> and copy the CDN code snippet of jQuery&rsquo;s latest release. The following is the code snippet for version 3.x:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&amp;lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.6.0\/jquery.min.js\"&amp;gt;&amp;lt;\/script&amp;gt;<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Locate the <strong>header.php<\/strong> file in your theme folder.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Locating-the-header-file-in-the-Twenty-Seventeen_s-theme-folder.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"381\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Locating-the-header-file-in-the-Twenty-Seventeen_s-theme-folder.png\/w=1024,h=1024,fit=scale-down\" alt=\"Locating the header file in the Twenty Seventeen's theme folder.\" class=\"wp-image-64897\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Locating-the-header-file-in-the-Twenty-Seventeen_s-theme-folder.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Locating-the-header-file-in-the-Twenty-Seventeen_s-theme-folder.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Locating-the-header-file-in-the-Twenty-Seventeen_s-theme-folder.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Locating-the-header-file-in-the-Twenty-Seventeen_s-theme-folder.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Open the file and paste the code snippet you obtained in the first step right below the <strong>&lt;head&gt;<\/strong> tag.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><a href=\"\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Adding-the-jQuery-CDN-script-to-the-theme_s-header-file.png\"><img loading=\"lazy\" decoding=\"async\" width=\"898\" height=\"550\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Adding-the-jQuery-CDN-script-to-the-theme_s-header-file.png\/public\" alt=\"Adding the jQuery CDN script to the theme's header file.\" class=\"wp-image-64898\" style=\"width:840px;height:514px\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Adding-the-jQuery-CDN-script-to-the-theme_s-header-file.png\/w=898,fit=scale-down 898w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Adding-the-jQuery-CDN-script-to-the-theme_s-header-file.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Adding-the-jQuery-CDN-script-to-the-theme_s-header-file.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/09\/Adding-the-jQuery-CDN-script-to-the-theme_s-header-file.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 898px) 100vw, 898px\" \/><\/a><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Save the changes made.<\/li>\n<\/ol><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro Tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\">You can also use this method to add other JavaScript libraries to your WordPress website.<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-4-make-sure-jquery-is-loaded\">4. Make Sure jQuery Is Loaded<\/h3><p>If you have already included jQuery in your website file, the &ldquo;Uncaught ReferenceError: jQuery is not defined&rdquo; error can be caused due to the code not loading correctly.<\/p><p>Therefore, the final step is to double-check the source code of the WordPress page in question and look for the <strong>&lt;script src=&rdquo;&rdquo;&gt;<\/strong> tag in the header part. You can use your browser&rsquo;s <a href=\"\/ng\/tutorials\/website\/how-to-inspect-and-change-style-using-google-chrome\/\">Inspect Element tool<\/a> to find the snippet faster.<\/p><p>Here are some examples of the source code to look for:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&amp;lt;script src=\"\/js\/jquery-3.6.0.min.js\" type=\"text\/javascript\"&amp;gt;&amp;lt;\/script&amp;gt;<\/pre><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&amp;lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.6.0\/jquery.min.js\"&amp;gt;&amp;lt;\/script&amp;gt;<\/pre><p>If the snippet refers to a file name like the first example, ensure it&rsquo;s spelled correctly. Otherwise, copy and paste the URL of the jQuery library to a new web page to see if it loads.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro Tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\">When copying and pasting a link, there might be extra spaces being added to it. Pay attention to this issue the next time you need to paste code snippets with URLs into your WordPress website files.<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-include-the-jquery-library-correctly\">How to Include the jQuery Library Correctly<\/h2><p>There are two ways to add the jQuery library to your website &#8210; including the source code in the <strong>HTML files<\/strong> or a <strong>new JavaScript file<\/strong>.<\/p><p>You can do the former method by downloading jQuery files or copying the jQuery CDN code snippet and adding the file path or URL to the header section of your HTML files. We already covered how to do both in the previous sections.<\/p><p>Despite being the easiest of the two, this method requires updating all HTML files if you want to use the latest jQuery version. It&rsquo;s why developers generally prefer the second method.<\/p><p>By putting the source code in a separate JavaScript file, you only need to make changes to that specific file and have it take effect on all the HTML files that call the function.<\/p><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-wordpress-hosting\" href=\"\/ng\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"600\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1536,fit=scale-down 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>No WordPress website is immune to the &ldquo;jQuery is not defined&rdquo; error. Luckily, there are four easy solutions to fix this common issue:<\/p><ul class=\"wp-block-list\">\n<li>Add the absolute path to the <strong>wp-config.php<\/strong> file.<\/li>\n\n\n\n<li>Include Google-hosted jQuery with an alternate fallback.<\/li>\n\n\n\n<li>Manually add the jQuery library to the theme&rsquo;s header file.<\/li>\n\n\n\n<li>Make sure jQuery is loaded correctly.<\/li>\n<\/ul><p>We hope this article has helped to solve your WordPress jQuery error. Good luck!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Around 80% of all websites are running on jQuery &ndash; if your WordPress site is one of them, you might encounter the &ldquo;Uncaught ReferenceError: jQuery is not defined&rdquo; error at some point. This error message indicates that your site can&rsquo;t call a function from the jQuery JavaScript library, causing one or multiple website elements to [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/wordpress-jquery-is-not-defined\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":115,"featured_media":144335,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"WordPress jQuery Is Not Defined Error: 4 Methods to Fix It","rank_math_description":"WordPress jQuery is not defined error is usually caused by mistake in the code. Check out this article to learn 4 methods to fix this error.","rank_math_focus_keyword":"wordpress jquery is not defined","footnotes":""},"categories":[22637],"tags":[],"class_list":["post-64895","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/wordpress-jquery-is-not-defined\/","default":1},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/wordpress-jquery-is-not-defined\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/wordpress-jquery-is-not-defined\/","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/wordpress-jquery-is-not-defined\/","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/wordpress-jquery-is-not-defined\/","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/wordpress-jquery-is-not-defined\/","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/wordpress-jquery-is-not-defined\/","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/wordpress-jquery-is-not-defined\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/64895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=64895"}],"version-history":[{"count":19,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/64895\/revisions"}],"predecessor-version":[{"id":144334,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/64895\/revisions\/144334"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/144335"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=64895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=64895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=64895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}