How to Remove jQuery Migrate from WordPress 3.6

April 5, 2013 by aaron
How to Remove jQuery Migrate from WordPress 3.6

WordPress 3.6 now automatically includes jQuery Migrate on all pages. If you keep your own jQuery code up-to-date and are sure that none of your plugins are incompatible with jQuery 1.9 or jQuery 1.10.2 (the new default version in WordPress 3.6), you can just remove the script from on the front-end.

Why remove jQuery Migrate?

  • If you care about performance, there is no reason to serve an extra JS file.
  • It’s better to keep your code, themes and plugins updated than it is to patch in support with an extra file.
  • If you are running plugins that use older jQuery code, it’s probably better to update them or switch to an alternative that is kept updated.

How to remove jQuery migrate from WordPress 3.6

Just add the following snippet to your theme’s function.php file.

add_filter( 'wp_default_scripts', 'dequeue_jquery_migrate' );

function dequeue_jquery_migrate( &$scripts){
		$scripts->remove( 'jquery');
		$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.10.2' );

Notes / Warnings

If you are unsure if your website requires jQuery Migrate, you can set define('SCRIPT_DEBUG', true); in your wp-config.php on a dev server and watch the console as you browser your site for any logs. However, don’t enable this on a development site unless you absolutely need to.

Make sure any external scripts don’t require the functions.

comments powered by Disqus

Do you want to get in touch?

Let us know what you want to create.

Contact Us