Remove WordPress emoji code in your pages head without plugin

Here is a quick tip to remove the piece of code added by WordPress 4.2 in the header of your pages about emoji icons

That’s the code WordPress adds in your page:

window._wpemojiSettings = {"baseUrl":"http:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/your-url\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.2.1"}};
    !function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f;c.supports={simple:d("simple"),flag:d("flag")},c.supports.simple&&c.supports.flag||(f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);

img.emoji {
    display: inline !important;
    border: none !important;
    box-shadow: none !important;
    height: 1em !important;
    width: 1em !important;
    margin: 0 .07em !important;
    vertical-align: -0.1em !important;
    background: none !important;
    padding: 0 !important;


How to remove the WordPress emoji code

In functions.php (your WordPress theme)
Add the following lines

remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');

remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );


42 thoughts on “Remove WordPress emoji code in your pages head without plugin

  1. I NEED HELP! The Code just poped up on my side and didnt do nothing!…. Now i get this Code (after removing the code): functions.php on line 402

    1. Revert to your precedent version of functions.php. I can’t help without more information. You might have copied the code at the wrong place in functions.php

    1. Sure, you can use a plugin if you wish. My post is about to do it without a plugin. I think less plugin on your WordPress instance the better.

  2. Thanks for providing this. I used the code but am still having some other errors which might not be related. Trying to remove Coinhive malware which I thought this emoji script might have been allowing.

    1. The emoji is coming from WordPress package directly so I am sure they would have fixed if any security issues were involved with it. My best recommendations would be to check the plugins you have installed.

Leave a Reply