It happened. Again. For some reason the WordPress 4.2 version included a lovely little script called ‘wp-emoji-release.min.js’ that loads at the end of the page.
And the dumb ’little’ Emoji helping script was actually causing my site to almost double its usual load time.
I mean, I looked at the website waterfall, and low and behold, here’s this little script at the end that’s just hanging. Cliff hanger style.
Just to type it out (I’m too lazy to get the picture back)
html - main script – picture1 — picture2 – – wp-emoji-release.min.js ——»»»>……. “for-e-ver. for-e-ver”
That’s what it really felt like. For…..e……v……er……….
Well, there’s an easy fix. Luckily you can drop scripts out of WordPress pretty easily. Just put this code in a custom plugin, function.php, mu-plugin, or whatever your heart desires.
// These first two lines remove the script from the public site remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'wp_print_styles', 'print_emoji_styles'); // These lines remove it from the admin panel. remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); remove_action( 'admin_print_styles', 'print_emoji_styles' );
Now reload, and no more wp-emoji-release.min.js and no more little emojis hanging onto the bottom of your page, dragging the load time through the roof.
(I’ll admit, that last line makes little sense save for in a Quantum world… but we’ll save that for another day.).
Credit to Abhishek Ghosh for the page of how to do it. Better than having to find the hooks myself.