In my theme, jQuery is loaded in the header by default. I even dequed it in my functions.php but still in the header I have the jquery :

function remove_jquery_migrate( &$scripts){
        $scripts->remove( 'jquery');
        $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.2.1' );
add_filter( 'wp_default_scripts', 'remove_jquery_migrate' );

function wpdocs_dequeue_script() {
    wp_dequeue_script( 'jquery' );
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );

but this is printed in the header:

<script type='text/javascript' src='...wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>

I don't know if a plugin is causing this but I want to remove this as I am already loading the jquery using Google CDN in the footer.

2 Answers 2


An example on how to deregister a WordPress built-in library and load your own:

function load_custom_scripts() {
    wp_deregister_script( 'jquery' );
    wp_register_script('jquery', '//code.jquery.com/jquery-2.2.4.min.js', array(), '2.2.4', true); // true will place script in the footer
    wp_enqueue_script( 'jquery' );
if(!is_admin()) {
    add_action('wp_enqueue_scripts', 'load_custom_scripts', 99);
  • thanks, will this still include the jquery in the header? can this be moved to footer? Commented Mar 20, 2017 at 13:40
  • I have amended my answer. if true, the last parameter will place the script in the footer. if false or empty, will place it in the header. keep in mind that if there are scripts, that require jquery, loaded in the header and you put jquery in the footer, they might not work.
    – The J
    Commented Mar 20, 2017 at 13:42

First of all: is your Google jquery enqueued properly? If you just dump the script link in the footer, WP won't know jquery is loaded and plugins that need it will enqueue it regardless of whether you dequeued it in your theme.

Secondly, are you sure you are enqueueing the right jquery version? If you enqueue an older version of jquery, a smart plugin might detect that and enqueue a later version to make itself work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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