WordPress Snippets

How to disable Emojis in WordPress

A quick guide on how to disable emojis from loading on your WordPress website.

Share:

Who doesn’t love an emoji? I use them all the time when messaging friends or family on Whatsapp, these little icons are ideal to express ideas or emotions.

But in 15 years working with WordPress, I have never used Emojis on my blog posts. Call me old fashioned but I don’t see the point, they add no real value to the reader.

The Emoji file is roughly 10.5kb in size and isn’t really big enough to cause your website any problems, but as your website grows, the more weight you can afford to throw overboard the better it will be for your site’s performance. No one wants a sinking ship.

A key optimisation tweak for WordPress websites is to try and reduce the number of HTTP requests they make: the fewer files your website has to load, the better the performance will be.

There are two ways you can disable Emojis, one is by using a plugin and the other is by disabling Emojis manually by using a code snippet. I always choose the latter because it’s my code and I know exactly what it’s doing.

If you do not want to get your hands dirty with code you can use the Disable Emojis plugin to disable Emojis on WordPress.

If you are like me and like to get your hands dirty, all you have to do is copy and paste the code snippet below into your theme’s functions.php file or you could also go the extra mile by adding the snippet as a custom plugin.

//Disable WordPress Emojis
// Remove Emoji Scripts and Styles
remove_action('wp_head', 'print_emoji_detection_script', 7);
// Remove Admin Emoji Scripts and Styles
remove_action('admin_print_scripts', 'print_emoji_detection_script');
// Remove Emoji Scripts and Styles
remove_action('wp_print_styles', 'print_emoji_styles'); 
// Remove Emoji Scripts and Styles
remove_action('admin_print_styles', 'print_emoji_styles');
// Remove DNS-Prefetch Meta For Emojis (s.w.org)
add_filter('emoji_svg_url', '__return_false'); 

I hope that helps. If you have found the snippet useful or if the code is not working for you, please comment below.

Popular