How to remove jQuery Migrate from WordPress?

When it comes to website optimization, even an additional request matters a lot, especially when users are accessing it from the mobile platform. jQuery is the biggest javascript file that is loaded alongside your theme. If your theme uses a mobile menu or similar jQuery-based functions, you will require jQuery anyway, but jQuery Migrate is just an additional file that loads with jQuery. Most of the time it is not required unless we are using decade-old functions. So in this tutorial, I am going to explain how to remove jQuery Migrate from WordPress.

jQuery Migrate

Make a backup of everything before you start any editing.

1. Open the “functions.php” file and add the following code.

Note: If you are not familiar with PHP then get some help, because you may break anything.

Locate functions.php file and add the following code at the end of the page.

// Remove jQuery Migrate
function atulhost_optimize_scripts() {
add_action('wp_enqueue_scripts', 'atulhost_optimize_scripts');

2. Save the “functions.php” file and clear the cache.

Simply save the file and delete all the cache to see it in action. Now check the homepage’s page source and look for jQuery Migrate script, it should be removed.

This is how we can remove jQuery Migrate script from WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *