I’m trying to run my jquery code on WP.
I use the correct hook (wp_head
/admin_head
) and dump the script tag
in the head tag
of the page after the the theme has linked jquery but it causes the following error and my script doesn’t run.
Uncaught ReferenceError: jquery is not defined
I maybe way out of focus here – and you did not show your whole code ( which is usefull in these cases ) , but …
from the error message :
maybe you need to write
jQuery
notjquery
( capitalQ
– javascript is case sensitive ) …That is ment for the script itself, not the dependencies of
wp_enqueue_script()
which do referencejQuery
asjquery
…Look at the document for wp_enqueue_script. If you look at the $deps parameter, you can use this in order to make sure that jquery gets loaded before your other jQuery calls in other js files.