How to prevent wordpress from loading old versions of jquery in wp_head();?

add_action('wp_enqueue_scripts', 'no_more_jquery');
function no_more_jquery(){
    wp_deregister_script('jquery');
}

That will deregister jquery. But why wouldn’t you want jQuery at all?

If you mean to simply use your own, you should do it in that function, like this:

add_action('wp_enqueue_scripts', 'no_more_jquery');
function no_more_jquery(){
    wp_deregister_script('jquery');
    wp_register_script('jquery', "http" . 
    ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . 
    "://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js", false, null);
    wp_enqueue_script('jquery');
}

This example loads Google’s jquery, but you could easily load one that you have in your own theme folder. You can read more about this process here: Function Reference/wp enqueue script « WordPress Codex

P.S. That would go in functions. And it is not a great idea to just stuff jquery library calls in your header, as it conflicts with plugins or other things that might be looking for jQuery to be present.

Leave a Comment