Disable Emoji Support in WordPress (4.2+)

Over the week I had a client’s WordPress crashing in iOS Safari after upgrading to WP 4.2.

I performed javascript debugging and realized the wp-emoji-release.min.js file was using a high amount of memory and cpu.

The WordPress emoji javascript file runs a regex on the entire page causing the browser to crash on mobile (due to lack of memory on mobile devices).

So if you’re not using emoji on your WordPress site you should disable it to speed up your site. Here are a few solutions to disable emoji in WordPress.

Easy (Plugin) Solution

All you need to do is install & activate the disable emojis plugin.
Disable Emojis Plugin on WordPress.org

If you want to enable the classic WordPress smileys use the plugin below.
Classic WordPress smileys on WordPress.org

Manual Functions.php Solution

If you want to disable Emoji support in your theme I’ve included the code below you can add to your theme’s functions.php file.

/**
* Disable Emoji Support
*/
function disable_emojis_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
function disable_emojis() {
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_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );

WordPress 4.2 was released on April 23, 2015 so if you’ve seen a performance dive after then it could be the issue. I had a very large page with lots of content so the wp-emoji-release.min.js file was working overtime.

Hope this helps someone out there!