As WordPress continues to improve, it adds new features into each release. Some of these features are significant, and some are very subtle. One subtle feature that didn’t notice sneak its way in was the new emoji support that WordPress added in version 4.2.
The WordPress documentation noted this new feature as follows:
You can still have fun — emoji are now available in WordPress! Get creative and decorate your content…
To display these emoji, WordPress now adds a new javascript file to your page loads, wp-emoji-release.min.js. However; if you find that you do not use emoji, myself as a perfect example, then there is not point on loading this additional javascript file, and you should consider disabling WordPress emojis to save the additional download request, and decrease your page load time.
Here are two ways that you can remove the emoji support in WordPress if you’re not using it:
Method #1: Disable WordPress Emojis Using a WordPress Hook
If you have access to your WordPress theme folder, you can add a couple of new lines to your functions.php file to disable WordPress emojis.
Place the following code within your WordPress theme’s functions.php file.
/* * Disable Emoji's */ if (!function_exists('disable_emojis_and_remove_support')) { function disable_emojis_and_remove_support() { // Remove 'print_emoji_detection_script' remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); // Remove 'print_emoji_styles' remove_action('wp_print_styles', 'print_emoji_styles'); remove_action('admin_print_styles', 'print_emoji_styles'); // Remove 'wp_staticize_emoji' remove_filter('the_content_feed', 'wp_staticize_emoji'); remove_filter('comment_text_rss', 'wp_staticize_emoji'); // Remove 'wp_staticize_emoji_for_email' remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); // Add Filter 'disable_emojis_support_in_tinymce' add_filter('tiny_mce_plugins', 'disable_emojis_support_in_tinymce'); // Add Filter 'disable_emojis_remove_dns_prefetch' add_filter('wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2); } } if (!function_exists('disable_emojis_support_in_tinymce')) { function disable_emojis_support_in_tinymce($plugins) { if (is_array($plugins)) { return array_diff($plugins, array('wpemoji')); } else { return array(); } } } if (!function_exists('disable_emojis_remove_dns_prefetch')) { function disable_emojis_remove_dns_prefetch($urls, $relation_type) { if ('dns-prefetch' == $relation_type) { $emoji_svg_url = apply_filters('emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/'); $urls = array_diff($urls, array($emoji_svg_url)); } return $urls; } } add_action('init', 'disable_emojis_and_remove_support');
Now save the file and reload your website. These lines should remove any and all traces of the WordPress emoji script and styles used for display.
Method #2: Disable WordPress Emojis Using a WordPress Plugin
If you’re not a developer, or don’t have access to your WordPress theme’s functions.php file. You can disable wordpress emojis by installing and activating a plugin instead.
To remove emoji support, I recommend installing the “Disable Emojis” WordPress plugin developed by Ryan Hellyer.
To install this plugin in WordPress, you can follow the following steps:
1. Navigate to the Plugin > Add New menu item.
2. Search for “Disable Emojis”. To differentiate it from other similar plugins, note that this plugin is developed by Ryan Hellyer.
3. Install and activate the “Disable Emojis” plugin.
It is important to note that the Disable Emojis plugin does not offer settings or any additional options; it just simply works! Upon activating the Disable Emojis plugin you should find that emoji support in WordPress is now completely disabled. You’ll find that by using this plugin, if you switch your website to using a new WordPress theme, you’ll still retain the disabled emoji settings; otherwise, you’ll need to copy over the functions.php code that disabled the WordPress emoji support.
If you have used or added emojis in one or more of your older posts, you’ll notice that disabling emojis will leave your emoji in plain text.