How to Remove Emoji Styles & Scripts in WordPress

WpFASTER Code 8 Comments

WordPress 4.2 + has added Emoji to the WordPress core. If you do not want or need Emoji it is best to remove/dequeue Emoji styles and scripts for better performance (less JavaScript and CSS = a good thing!). To remove Emoji from your WordPress site, copy and paste this code snippet — in plain text — to your functions.php file, or, add it with a plugin like Code Snippets.

The fastest possible version of your website is no longer optional. We can help! Learn more…

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' );

Comments 8

    1. Post
      Author

  1. this is greate tutorial men….thanks alot..
    you can also follow this code for better result……

    function disable_wp_emojicons() {
    // remove 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’ );
    }
    add_action( ‘init’, ‘disable_wp_emojicons’ );

    1. Actually the complete function to disable emojis would be:

      function wp_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’, ‘wp_disable_emojis’);

      Removing emojis is a sound decision performance wise. However, if you want to get rid of all emojis due to design inconsistencies, using the plugin discussed or extending your functions-file is just part of the equation. People will still be able to use Emoji characters. Whether these are displayed properly depends on native support (http://caniemoji.com/). The only solution is to use a regular expression matching the Unicode emoji list and then replace them with your own for a unified look (isn’t WordPress trying to do that?) or remove them from the string altogether. Emojis have changed the way we communicate, love them ❤️ or hate them ?.

Leave a Reply

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