When we are optimizing our wordpress site, we have found wordpress usually load two jquery files. They are:
<script type='text/javascript' src='https://www.tutorialexample.com/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script> <script type='text/javascript' src='https://www.tutorialexample.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script>
However, jquery-migrate.min.js is usually unuseful for wordpress theme, it can be removed.
Why does wordpress use jquery-migrate.min.js?
jquery-migrate.min.js can allow some wordpress theme to uses old version jquery. However, most of themes use latest jQuery file, this file can be removed.
How to remove jquery-migrate.min.js?
It is very easy to remove it. Open your theme functions.php and add code below:
function cedaro_dequeue_jquery_migrate( $scripts ) { if ( !is_admin() && !empty( $scripts->registered['jquery'] ) ) { $jquery_dependencies = $scripts->registered['jquery']->deps; $scripts->registered['jquery']->deps = array_diff( $jquery_dependencies, array( 'jquery-migrate' ) ); } } add_action( 'wp_default_scripts', 'cedaro_dequeue_jquery_migrate' );
Save it.
Then you will find wordpress theme will only load jquery.js?ver=1.12.4 file.