The Simplest Way to Disable Emojis in WordPress

[ad_1]

Are you in search of a manner to disable emojis in WordPress? Disabling the WordPress emoji file can get rid of an HTTP request in your website, with out affecting the expertise for many of your guests.

Fortunately, it’s very easy to disable emojis in WordPress utilizing a free plugin. However, for extra technical customers, you may want to disable emojis utilizing code. This requires you to edit your youngster theme’s capabilities.php file (or apply the code to a code snippets plugin).

Why you may want to disable emojis in WordPress

The major purpose to disable WordPress emojis is to enhance efficiency in your website.

By default, WordPress already helps most emojis in fashionable browsers with out the necessity for any additional recordsdata. However, to guarantee help for older browsers, WordPress added additional emoji help in WordPress 4.2. In current variations, this emoji help provides a single wp-emoji-release.min.js file to each web page in your website.

Loading this file provides an additional HTTP request to your website. But on the identical time, it’s not wanted to make emojis work for many of your customers. As such, disabling this file may help you scale back your HTTP requests and obtain a very small efficiency enhance.

It’s vital to be clear that after we discuss “disabling emojis in WordPress,” we’re really targeted on disabling the additional emoji file bloat that WordPress hundreds. Even should you disable this file, most customers will nonetheless have the option to add and look at emojis.

For instance, they might use their machine’s emoji keyboard or copy and paste from a website like Emojipedia.

The easiest method to disable emojis in WordPress

Now that you recognize why you may want to disable emojis in WordPress, let’s check out the only manner to achieve this.

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

1. Disable emojis in WordPress utilizing a plugin

The simplest way to disable emojis in WordPress is to use a plugin like Disable Emojis (GDPR pleasant). While the plugin doesn’t take away emojis, it disables the additional checks and scripts that trigger bloat in your website.

This manner, you’ll be able to proceed to permit guests to use (and look at) emojis so long as their browser helps this performance.

Plus, you’ll be able to be sure that your website stays GDPR-friendly, and keep a clean consumer expertise (UX).

One of one of the best components about Disable Emojis is that it’s fully free and tremendous simple to arrange. All you want to do is head to Plugins > Add New inside your WordPress dashboard. Then, seek for “Disable Emojis:”

Here, click on on Install Now > Activate. The plugin begins working mechanically. In truth, there aren’t any configuration settings that want to be utilized, so at this stage, you’re all set.

2. Disable emojis in WordPress utilizing code

Although a plugin is the only manner to disable emojis in WordPress, you too can disable emojis utilizing code. However, you’d want to edit your youngster theme’s capabilities.php file which requires some technical data. Plus, it may be dangerous since a flawed line of code can break your website.

That’s why you may want to make the change by making use of the code to a plugin like Code Snippets.

It is good for inexperienced persons because it allows you to edit vital elements of your website with out the danger of breaking it. Plus, it’s completely free, so you’ll be able to go proper forward and set up the plugin out of your dashboard.

Once you’ve activated the plugin, merely head to Snippets out of your admin space. Then, click on on Add New. You’ll see a clean snippet field like this one:

Give your snippet a title first – one thing like “disable emojis” is sensible. Next, paste in the following code snippet into the primary snippet field:

/**
 * Disable the emoji's
 */
perform 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 perform used to take away the tinymce emoji plugin.
 * 
 * @param array $plugins 
 * @return array Difference betwen the 2 arrays
 */
perform 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 useful resource hints.
 * @param string $relation_type The relation sort the URLs are printed for.
 * @return array Difference betwen the 2 arrays.
 */
perform 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, choose the choice to Run the snippet in all places (picture above) and click on on Save Changes and Activate.

Your snippet is now working and the emojis have been disabled out of your WordPress website.

Disable emojis in WordPress to enhance efficiency

WordPress launched emojis to add native help to language character units. However, due to the extra scripts and code they require, emojis can decelerate your web site. Therefore, you may want to disable emojis in WordPress to enhance your efficiency.

To recap, listed here are two easy methods to disable emojis in WordPress:

  1. Disable emojis in WordPress using the straightforwardly-named plugin, Disable Emojis (GDPR pleasant).
  2. Disable emojis in WordPress utilizing code. You can do that instantly by modifying your capabilities.php file, or use a code snippets plugin like Code Snippets.

Do you’ve gotten any questions on how to disable emojis in WordPress? Let us know in the feedback part under!

[ad_2]


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *