Since the release of WordPress 4.2, support for emoji icons has been added into the mix of the many ongoing upgrades to the WordPress core. This has been continues with mixed reviews, in some cases emojis can be a welcomed fun upgrade to spice up your blog but from the more professional side of things they aren’t really needed.

You might be saying, well if you don’t want them then simply don’t use them… right? Wrong, even if you aren’t utilizing the emojicons on your site, your site is still loading all of the CSS and JS used to drive them which increases load time slowing down your site. In this tutorial we will teach you how to remove and disable emoji support by simply adding a code snippet to your functions file.

What are emojis?

Emoji are the ideograms or smileys 1f604.png used in electronic messages and Web pages. Originating in Japan on mobile devices, they are now commonly available on devices worldwide, ranging from mobile to desktop computers.
For more referance visit WordPress’s documentation : https://codex.wordpress.org/Emoji

Remove CSS and JS Functions

Put the following code in your function.php file. Function.php file is located in your active theme’s root folder.

function disable_wp_emojicons() {

  remove_action( 'admin_print_styles', 'print_emoji_styles' );
  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_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
  remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
  remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );

  // filter to remove TinyMCE emojis

  add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );

}
add_action( 'init', 'disable_wp_emojicons' );

// Disable TinyMCE emojicons

function disable_emojicons_tinymce( $plugins ) {
  if ( is_array( $plugins ) ) {
    return array_diff( $plugins, array( 'wpemoji' ) );
  } else {
    return array();
  }
}

//Remove DNS Prefetch

add_filter( 'emoji_svg_url', '__return_false' );;

Now your site free from emojis.
Enjoy the coding. 🙂

There are currently no comments.