0

For wordpress blog, even after removing wp_enqueue_script('jquery'); from theme function jquery is getting loaded, so I have two query:

  1. From where jquery is getting loaded
  2. How to move default jquery to footer before body tag ends

1 Answer 1

0

jQuery is built into WordPress, so if any other enqueued script relies on it, it's automatically loaded.

To move it to the footer, you have to reregister it, like this:

function my_footer_jquery () {
    wp_deregister_script ('jquery');
    wp_register_script ('jquery', includes_url ('/js/jquery/jquery.js'), array (), NULL, true);
    wp_enqueue_script ('jquery');
}
add_action ('wp_enqueue_scripts', 'my_footer_jquery');
1
  • I tried doing this, ideally while registering script if last argument is true it should come in footer but for my blog it is coming in head only, not able to figure out the exact reason behind this
    – Nitish
    Commented Jan 5, 2017 at 11:22

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.