How To Disable Emojis In WordPress

Some of us love emojis and some of us hate them. Support for emojis was added to WordPress back in version 4.2, but a small unknown fact about WordPress is that emojis actually slow down your site. In this post, we will teach you how to disable emojis in your WordPress to speed up your site.
A quick way to disable emojis is to use a plugin like Disable emojis, but for more experienced WordPress users you can simply head over to your functions.php file and add the following code that will disable all emojis and remove them from the whole page.
/**
* Disable the emoji's
*/
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' );
// Remove from TinyMCE
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );/**
* Filter out the tinymce emoji plugin.
*/
function disable_emojis_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
And that’s it. Your site should now be free of emojis. To find out the effect it might have had on your site speed, use the Google PageSpeed Insight tool.
If you liked this small guide check out more at BlogInbox.com.