WP Snipp Ninja

How to disable WordPress Emoticones in your functions.php?

Author: Dimitar Krumov | Posted on: June 25, 2018 |


Emojis are little icons used to express ideas or emotions


Don’t forget to back-up your functions.php before implementing these codes. WordPress automatically loads the file wp-emoji-release.min.js on the front-end of your WordPress website to help loading emojis that are part of the blogging feature of WordPress. This can slow your WordPress Website. So it is a good idea to disable wp_emojicons in your WordPress website installation.

WordPress Emojis is great for the users who need it, but most of the WordPress developers and professional websites have no need for emojis on their WordPress website. This of course can be easily ignored, as it is a few lines of code that need to be implemented in your theme functions.php file. However, it is a script that is being loaded into your WordPress site, and does factor into the loading speed of your site, no matter how little is impact can be. Disabling WordPress Emojis can help and Speed up your website.

Adding this code will remove wp-emoji-release.min.js and stop it from loading on your WordPress site. Again, do this only if you’re not using emojis on your WordPress Website!


Removing this script is very easy and you need to add a few lines of code below in your functions.php file

Add these few lines of code to a PHPÂ file that is being loaded, such as the functions.php file in your theme. Alternatively, you can create a very simple plugin with just that code in it.


function disable_wp_emojicons() {

  // all actions related to emojis
  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' );

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

add_filter( 'emoji_svg_url', '__return_false' );

Another bigger impact of disabling WordPress emojis, is the fact that it loads in the head of your WordPress website, and tools such like Google Page Speed Insights or Pingdom identify it as render-blocking JavaScript. This is something you will want to address if you are concerned with site loading time and site speed optimisation. Every SEO know the optimizing your website speed, is a big factor into improving your SEO score for the most Search engines like Google, Yahoo and Bing.


About the Author

 Dimitar Krumov

Hello my name is Dimitar Krumov I am from Sofia Bulgaria but live in Varna on the Black Sea coast.I am a Web Developer since 2002 working in different Web Projects most of them are international and business-related. Some of my knowledge and skills but not limited to WordPress, HTML, CSS, Google Stack, Analytics, SEO and more..


Follow Dimitar Krumov on Social Media

Leave a Reply

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