Installed Fresh wordpress version 5.8
Theme active – Twenty Twentyone
Problem – Jquery library doesn’t load on front-end.
Tried to run few Jquery commands in header.php but error generates in Inspect element tool saying "Jquery is not defined". I understand by default wordpress comes bundled with Jquery which is included in wp-includes directory.
2
Answers
I fixed it myself.
The Problem was related to wordpress Twenty Twentyone theme. Wordpress actually comes bundled with Jquery but the new Twenty Twentyone theme doesn't include code to enable/register Jquery. I placed a code in functions.php to register Jquery with this theme and now the Jquery is loading on frontend.
Here is I used in functions.php
The Previous wordpress theme like Twenty Sixteen , Twenty Thirteen always had this code implemented in functions.php file so we always got Jquery library loading at front-end.
Typo? Jquery() vs. jQuery().
Otherwise, try viewing source and clicking through to the linked jQuery file. The WP hosting environment could play a part here in whether the file is linking correctly.
** update – great you managed to sort it!