{"id":4577,"date":"2024-01-06T16:07:58","date_gmt":"2024-01-06T16:07:58","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=4577"},"modified":"2026-04-27T12:06:49","modified_gmt":"2026-04-27T11:06:49","slug":"uncaught-referenceerror-jquery-is-not-defined","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/wordpress\/issues-and-errors\/uncaught-referenceerror-jquery-is-not-defined","title":{"rendered":"Uncaught ReferenceError: jQuery is not defined"},"content":{"rendered":"\n<p>Can happen when a non admin logged in user is on the site and nothing that requires jQuery is part of the page so your theme decides not to load it. If your custom code, e.g. some javascript on a page, needs it then you can use this to cause it to always be loaded<\/p>\n\n\n\n<p>Add this code to your theme functions.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/********** ENSURE jQuery IS ALWAYS LOADED ON PAGES **********\n\/\/(we use in our custom code)\nadd_action( 'wp_enqueue_scripts', 'MyThemeEnqueueScripts' );\nfunction MyThemeEnqueueScripts()\n{\n  wp_enqueue_script( 'jquery' );\n}\nadd_action( 'admin_enqueue_scripts', 'MyAdminEnqueueScripts' );\nfunction MyAdminEnqueueScripts( $hook )\n{\n  wp_enqueue_script( 'jquery' );\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Can happen when a non admin logged in user is on the site and nothing that requires jQuery is part of the page so your theme decides not to load it. If your custom code, e.g. some javascript on a page, needs it then you can use this to cause it to always be loaded [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[357],"tags":[],"class_list":["post-4577","post","type-post","status-publish","format-standard","hentry","category-issues-and-errors"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=4577"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4577\/revisions"}],"predecessor-version":[{"id":5388,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4577\/revisions\/5388"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=4577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=4577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=4577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}