How to Disable Emojis in WordPress (Step by Step)

0
32

Are you wanting to disable emojis in your WordPress web site?

Emojis are small icons which might be used to specific emotions or feelings. WordPress masses extra CSS and a JavaScript file to add emoji help and a few customers might want to take away it to enhance efficiency and pace.

In this text, we’ll present you the way to simply disable emojis in WordPress.

How to disable emojis in WordPress 4.2

What Are Emojis?

Emojis are the tiny icons or smileys used on the web.

Originating from Japan, emojis have made their method into the Unicode character set and are actually supported by desktop computer systems in addition to iOS and Android cellular units.

The emojis function was first launched in WordPress 4.2 and the first cause for including this function was to add native help for Chinese, Japanese, and Korean language character units.

Emojis example

By default, WordPress masses a further JavaScript file and a few CSS to add emoji help.

You can see it by viewing your web site’s supply code or by utilizing the Inspect tool.

Emoji JavaScript in WordPress

However, some web site homeowners might want to disable this additional emoji help to increase WordPress speed and performance by not downloading extra code and scripts.

Note: When we are saying disabling Emoji in WordPress, we imply disabling the additional checks and scripts used by WordPress to deal with Emojis. You can nonetheless use Emoji in your web site, and the browsers that help them will nonetheless give you the option to show them.

Having mentioned that, let’s check out how to simply disable Emoji help in WordPress.

Method 1. Disabling Emojis in WordPress Using Code

For this technique, we’ll be utilizing a customized code snippet to disable emoji help in WordPress.

You can add this code snippet to your WordPress theme’ functions.php file or a site-specific plugin. However, a tiny error in the code may simply break your web site and make it inaccessible.

To keep away from this, we advocate utilizing WPCode. It is one of the best code snippets plugin for WordPress and provides the most secure method to add customized code to your web site with out breaking it.

First, you want to set up and activate the WPCode plugin. For extra directions, see our information on how to install a WordPress plugin.

After activation, merely go to the Code Snippets » All Snippets web page from the WordPress admin dashboard.

From right here, you want to click on the ‘Add New’ button on the prime.

Add new code snippet

This will take you to the ‘Add Snippet’ web page.

From right here, take your mouse over to the ‘Add Your Custom Code (New Snippet)’ choice after which click on the ‘Use snippet’ button.

Click Use Snippet button

This will carry you to the ‘Create Custom Snippet’ web page. You can begin by typing a reputation in your code snippet. It could be something you want.

After that, you want to choose ‘PHP Snippet’ as your ‘Code Type’ from the drop-down menu current in the proper nook.

Type a name for your code snippet and choose PHP as code type

Now all you want to do is copy and paste the next code in the ‘Code Preview’ 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 kind 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/photos/core/emoji/2/svg/' );

$urls = array_diff( $urls, array( $emoji_svg_url ) );
 }

return $urls;
}
Paste your code snippet

After that, scroll down to the ‘Insertion’ part to select an insert technique in your code.

Simply choose the ‘Auto Insert’ mode in order that the code could be mechanically executed in your web site upon activation.

Choose Auto Insert as insert method

Now return to the highest of the web page and toggle the change on the proper from ‘Inactive’ to ‘Active’.

Finally, click on the ‘Save Snippet’ button to save your customized code snippet.

Click the Save Snippet button to save changes

That’s all, you will have efficiently disabled emojis in WordPress.

Method 2. Disable Emojis in WordPress Using a Plugin

For this technique, we’ll be utilizing a plugin to disable Emojis in WordPress.

First, you want to set up and activate the Disable Emojis plugin. See our information on how to install a WordPress plugin for extra directions.

The plugin works out of the field and there aren’t any settings for you to configure.

Upon activation, it would mechanically disable emoji help out of your WordPress web site.

We hope this text helped you find out how to disable Emojis in your WordPress web site. You can also need to take a look at our information on how to create a custom Facebook feed in WordPress and our article on how to add web push notifications to your WordPress site.

If you preferred this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You can even discover us on Twitter and Facebook.

The put up How to Disable Emojis in WordPress (Step by Step) first appeared on WPBeginner.



Source link