WordPress version 4.2 came with a small surprise for many website owners and theme developers: WordPress will automatically load emojis in the header of the website with no easy way to disable them.
Generally this is not a big deal, but when you are trying to optimize a website as much as possible, then the emojis have got to go.

Personally I’m not a big fan of this junk in the header. It is probably irrelevant on 99% of WordPress websites, and yet it is there by default.
Disable Emojis with a (free) Plugin
Fortunately there’s a simple (and free) plugin that does all the work for you.
Simply download, install and active the Disable Emojis plugin. You don’t have to do anything else. It also works on multisite installations, so if you have a network of WordPress websites, simply Network Activate this plugin and the problem will go away.
Disable Emojis via functions.php
In some cases you want to avoid having active plugins just to fix small issues, and this might be one of those cases.
You can add the following code to the functions.php file inside your theme and it will accomplish the same thing.
The downside is that you will have to add this code again when you will switch your active theme.
function themename_disable_wp_emojicons() {
// remove all actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
// add filter to remove emojis from the TinyMCE editor
add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );
}
add_action( 'init', 'themename_disable_wp_emojicons' );
In Conclusion
It is weird that something like this would come with WordPress default without an easy way of disabling it. A simple checkbox in the Settings > Discussion or Settings > Reading would be very welcome.
WordPress 4.2 came out in April 2015 and since then (at the time of writing this) there has been no option to disable emojis.
Be the first to comment