Disable Emoji for WordPress

Today I’ve read some article at PostStatus about the Trojan Horse Emoji and I’m still wondering why the Emoji feature becomes a part of the WordPress core. There are so many important features which could improve WordPress, but we got something no one likes :( … Wait, I disabled Emoji for this website and I’m still seeing this new Frownie image???

Video: Anatomy of a Critical Security Bug

Watch this Youtube video where Andrew Nacin talks about the critical security vulnerability and how it was discovered and patched in WordPress 4.2.

After the update to WP 4.2, the first thing I have noticed was a long JS/CSS snippet inside the HEAD of my website. Something I don’t like for a feature I didn’t asked for. The old smiley replacement function has got some new images and that is enough for me. So I decided to disable Emoji for this and many other websites I manage.

How to disable Emoji for your WordPress 4.2 website?

You can use one of these plugins

  • Disable Emojis – This plugin disables the new Emoji functionality in WordPress 4.2.
  • Classic Smilies – Replace the smilies with the original versions from previous versions of WordPress.

or copy / paste this code posted by Otto on Github into your theme’s functions.php file.

add_action( 'init', 'disable_emoji', 1 );
function disable_emoji() {
     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_action( 'admin_print_styles', 'print_emoji_styles' );
     remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
     remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
     remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
     add_filter( 'tiny_mce_plugins', 'disable_tinymce_emoji' );
 }
 // filter function used to remove the tinymce emoji plugin
 function disable_tinymce_emoji( $plugins ) {
     return array_diff( $plugins, array( 'wpemoji' ) );
 }

What’s next? Is there a chance that this useless feature will become a feature plugin in one of the next versions? Would be good to know (before I update all my customer websites).