2024 so far has been all about trying to optimize Extra Chill in the wake of all these Google updates. Like most content sites, we have taken a massive hit to our organic traffic and we are willing to try anything to recover.
One of the biggest things for my site was Page Speed. Extra Chill uses the ColorMag Pro theme which I installed in 2018 or so, and then proceeded to customize without a child theme (don’t do this if you’re a noob). This meant that back in September, prior to all of my optimizations, I was working with a clunky site on an outdated beginner theme.
Part of my efforts were removing lots of Javascript in order to speed up the site. Eventually, I got to a point where I had removed or consolidated all of my JS files into only what is absolutely necessary to make my site function.
Then, I checked PageSpeed insights and noticed that Jquery.min.js was still being enqueued in the frontend. Since nothing else was using it, I decided to get rid of it.
Disclaimer
Please note that removing jQuery from the WordPress frontend is not exactly recommended because of how many plugins use the library. However, if you’re absolutely sure that you’ve done your due diligence, removing it can be the final top-up to get your WordPress site running to its peak performance.
Also note that the WordPress backend makes heavy use of jQuery as does the admin bar. It is recommended, required, even, to use jQuery in the back end.
Okay, now that I’ve got that out of the way. To remove jQuery from the WordPress frontend, simply add this script to your theme’s functions.php file (or child theme, or custom plugin).
This will save you about 30kb of page data. Every byte counts!
Code Snippet to Remove jQuery
function remove_jquery_script() {
if (!is_admin()) { // Ensure jQuery is still loaded in the admin
wp_deregister_script('jquery');
wp_register_script('jquery', false);
}
}
add_action('wp_enqueue_scripts', 'remove_jquery_script', 11);