disable emojis in wordpress

Are you looking for a way to disable emojis in WordPress? βœ‹ Disabling the WordPress emoji file can eliminate an HTTP request on your site, without affecting the experience for most of your visitors.

Fortunately, it’s really easy to disable emojis in WordPress using a free plugin. However, for more technical users, you might prefer to disable emojis using code. This requires you to edit your child theme’s functions.php file (or apply the code to a code snippets plugin).

In this post, we’ll take a closer look at why you might want to disable emojis in WordPress. Then, we’ll walk you through two easy methods. Let’s jump right in! 🦘

Why you might want to disable emojis in WordPress

✌️ 🍸 😷 πŸ† πŸ’« 🌱 🍠 ⏯ πŸ™ πŸ‘ 😐 🐞 🎒 πŸ’‘ 🐼 πŸ“˜ 🚁 πŸ“… πŸ’» πŸ˜— β˜‚ β›Ž πŸ“£ πŸ™ƒ πŸ“² πŸ‘₯ βœ‚οΈ

The main reason to disable WordPress emojis is to improve performance on your site.

By default, WordPress already supports most emojis in modern browsers without the need for any extra files. However, to ensure support for older browsers, WordPress added extra emoji support in WordPress 4.2. In recent versions, this emoji support adds a single wp-emoji-release.min.js file to every page on your site.

Loading this file adds an extra HTTP request to your site. But at the same time, it’s not needed to make emojis work for most of your users. As such, disabling this file can help you reduce your HTTP requests and achieve a very small performance boost.

It’s important to be clear that when we talk about “disabling emojis in WordPress,” we’re actually focused on disabling the extra emoji file bloat that WordPress loads. Even if you disable this file, most users will still be able to add and view emojis.

πŸ‘‰ For example, they could use their device’s emoji keyboard or copy and paste from a site like Emojipedia.

The simplest way to disable emojis in WordPress

Now that you know why you might want to disable emojis in WordPress, let’s take a look at the simplest way to do so.

  1. Disable emojis in WordPress using a plugin
  2. Disable emojis in WordPress using code

1. Disable emojis in WordPress using a plugin

The easiest way to disable emojis in WordPress is to use a plugin like Disable Emojis (GDPR friendly). While the plugin doesn’t remove emojis, it disables the extra checks and scripts that cause bloat on your site.

This way, you can continue to allow visitors to use (and view) emojis as long as their browser supports this functionality.

Plus, you can ensure that your site remains GDPR-friendly, and maintain a smooth user experience (UX).

One of the best parts about Disable Emojis is that it’s completely free and super easy to set up. All you need to do is head to Plugins > Add New within your WordPress dashboard. Then, search for “Disable Emojis:”

Install the Disable Emojis plugin.

Here, click on Install Now > Activate. The plugin starts working automatically. In fact, there are no configuration settings that need to be applied, so at this stage, you’re all set.

2. Disable emojis in WordPress using code

Although a plugin is the simplest way to disable emojis in WordPress, you can also disable emojis using code. However, you’d need to edit your child theme’s functions.php file which requires some technical knowledge. Plus, it can be risky since a wrong line of code can break your site.

That’s why you might prefer to make the change by applying the code to a plugin like Code Snippets.

It is ideal for beginners since it enables you to edit important aspects of your site without the risk of breaking it. Plus, it’s totally free, so you can go right ahead and install the plugin from your dashboard.

Once you’ve activated the plugin, simply head to Snippets from your admin area. Then, click on Add New. You’ll see a blank snippet box like this one:

Adding new snippet.

Give your snippet a title first – something like “disable emojis” makes sense. Next, paste in the following code snippet into the main snippet box:

/**
 * 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' );
 add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
 add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
}
add_action( 'init', 'disable_emojis' );
 
/**
 * Filter function used to remove the tinymce emoji plugin.
 * 
 * @param array $plugins 
 * @return array Difference betwen the two arrays
 */
function disable_emojis_tinymce( $plugins ) {
 if ( is_array( $plugins ) ) {
 return array_diff( $plugins, array( 'wpemoji' ) );
 } else {
 return array();
 }
}
 
/**
 * Remove emoji CDN hostname from DNS prefetching hints.
 *
 * @param array $urls URLs to print for resource hints.
 * @param string $relation_type The relation type the URLs are printed for.
 * @return array Difference betwen the two arrays.
 */
function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
 if ( 'dns-prefetch' == $relation_type ) {
 /** This filter is documented in wp-includes/formatting.php */
 $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;
}

Lastly, select the option to Run the snippet everywhere (image above) and click on Save Changes and Activate.

Your snippet is now running and the emojis have been disabled from your WordPress site. πŸ™‹β€β™‚οΈ

Disable emojis in WordPress to improve performance πŸ“ˆ

WordPress introduced emojis to add native support to language character sets. However, due to the additional scripts and code they require, emojis can slow down your website. Therefore, you might want to disable emojis in WordPress to improve your performance.

To recap, here are two simple ways to disable emojis in WordPress:

  1. πŸ”Œ Disable emojis in WordPress using the straightforwardly-named plugin, Disable Emojis (GDPR friendly).
  2. πŸ‘¨β€πŸ’» Disable emojis in WordPress using code. You can do this directly by editing your functions.php file, or use a code snippets plugin like Code Snippets.

Do you have any questions about how to disable emojis in WordPress? Let us know in the comments section below!

Free guide

4 Essential Steps to Speed Up
Your WordPress Website

Follow the simple steps in our 4-part mini series
and reduce your loading times by 50-80%.Β πŸš€

Free Access

0 Comments
Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!