How to avoid jQuery-migrate.js from loading in WordPress 3.6?

Updated on September 2, 2017

If you have upgraded your wordpress site to 3.6, then you might have noticed an extra jQuery is being loaded to HTML source code. This is because WordPress 3.6 automatically includes jQuery migrate script on all pages. If you are sure that none of your plugins or code is using jQuery migrate, then you can choose to remove it. Removing an extra jQuery script has several advantages : the performance of your site will be improved as you are loading only necessary jQuery file and not something that you don’t use it and you’ll keep your code clean to preventing unnecessary conflicts.

Ok! If you are someone who wants to remove jQuery-migrate.js from all of your wordpress pages, then here’s how you can do that.

Add the below lines to function.php file located in your theme directory.

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' );

Not sure whether your site requires jquery-migrate.js? Then it is better to add the below line to wp-config.php file and monitor for any errors while you browse the site.

define('SCRIPT_DEBUG', true);

Was this article helpful?

Related Articles

Leave a Comment