Technically we should not remove default jquery.js file, but we need removal for speed. Here is how to remove jquery.js and jquery-migrate.js. You can expect that, after a couple of years; for not having HTTPS and a super fast website, even with good content like ours, you can get highly penalized. Browsers might throw such horrible scary message, an ordinary user, if somehow finds your website will fly away. We wrote about How to Eliminate Render-blocking Javascript and CSS in WordPress almost a year back from today and it took 9 months for us to really implement. Yet, we know there are points can be made better. The reason of this huge time consumption is nothing but – WordPress has certain peculiar problems and the not all the Plugins are 100% compatible with the latest version we use.
Check Usability Before Searching For How To Remove jquery.js and jquery-migrate.js in WordPress
Removing both these files – jquery.js
and jquery-migrate.js
by deregistering the scripts and then injecting the scripts in some way can pathetically break certain plugin’s function. The reason possibly is the order of HTML5 DOM loading via scripts. You can expect abnormal functions of syntax highlighter, image slideshow plugins on the fronted.
It might happen that removal of only one will not break your website. But removing both the default core files, even compromising Page Speed CDN Tick is acceptable if everything goes rightly. All of us making the WordPress faster by combination of multiple plugins, manual codes in theme’s functions.php
file. For logical conflict, many things which are not expected can happen.
---
Forget more complex factors like server side caching, implementation of CORS, DNS caching, HTTP Caching. Front end designing has been so much difficult, that sometimes we need to compromise. Not all, essentially can pay a better front end designer or might not like all the modifications done by him/her. A bit compromise :
How To Remove jquery.js and jquery-migrate.js in WordPress
This is for removing jquery-migrate.js
:
1 2 3 4 5 6 7 8 9 | add_filter( 'wp_default_scripts', 'remove_jquery_migrate' ); function remove_jquery_migrate( &$scripts) { if(!is_admin()) { $scripts->remove( 'jquery'); $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.10.2' ); } } |
And this is for removal of jquery.js
:
1 2 3 4 | add_action('wp_enqueue_scripts', 'no_more_jquery'); function no_more_jquery(){ wp_deregister_script('jquery'); } |
You can see a dream like score with this design with WordPress :
1 | https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fthecustomizewindows.com%2Fprivacy-policy%2F&tab=desktop |
If we load more images inside a post, our score will get worser. Additionally Ads will decrease the score. We are retaining the function of default jquery.js
loading, because simply – you would be unable to copy the above codes if we disturb the sequence.
A server, takes a bit time to clear the Cached files, again generate gzip files. It is not a great idea to test too much.
Tagged With wordpress jquery optimization , remove jquery from wordpress , migrate js , jQuery Remove JS File , jquery migrate js , jquery migrate genesis , jquery migrate file needed? , how to uninstal jquery plugin for good , how to remove the wp-includes jquery js file in wordpress , wordpress render-blocking javascript jquery js