Loading jquery locally

Although it seems like you should be able to just call the function and have it load the script, it’s slightly more complicated. Instead, scripts need to be registered and enqueued inside a hook, so they’re loaded in the right order.

To get jQuery loaded on the front end of your theme wrap the function call inside a callback for the wp_enqueue_scripts action. One way is to add this to your theme’s functions.php file:

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

See https://developer.wordpress.org/reference/functions/wp_enqueue_script/#notes for more info.