WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed my twenty twelve theme is including outdated versions of jquery and js so I want to replace the scripts with the newer versions, however the scripts are in the file included by wp_head() (which I think is in wp-includes) so adding the scripts to my header means jquery will be loaded twice, I see now way to remove the scripts from wp_head() without messing with wp-include and any changes I do will probably be lost if I update wordpress.

So how can I remove the scripts from wp_head() permanently?

share|improve this question
up vote 5 down vote accepted
add_action('wp_enqueue_scripts', 'no_more_jquery');
function no_more_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_register_script('jquery', "http" . 
    ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . 
    "://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js", false, null);

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.

share|improve this answer
thanks. I added jquery and jquery-ui through this way. I don't want to change anything outside my child theme so this is a great solution. – Lisandro Vaccaro Aug 23 '13 at 15:19

Simplest way to update jQuery is to use jQuery Updater plugin

If you just want to remove the wordpress version then add


to your functions.php

share|improve this answer


wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/<version of required version of jquery>/jquery.min.js", false, null); wp_enqueue_script('jquery');

just before wp_head()

I am not sure if this method is faster than @GhostToast answer

share|improve this answer
Definitely not the correct way. Have a look at wp_deregister_script in the codex – Pieter Goosen Jul 23 '14 at 12:29
you are right unless we add another jquery file manually which is not very best practice, it is dirty but it works :) And I made an edit – Binod Jul 23 '14 at 13:00
It maybe works, but should never be done in this way. Always register/deregister/enqueue/dequeue scripts and styles through the wp_enqueue_scripts hook as in ghosttoast's answer – Pieter Goosen Jul 23 '14 at 13:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.