Support » Fixing WordPress » Emoji and smiley js and css added to head

  • Resolved semrocc


    When updating WordPress to 4.2, there is a bunch of JS and CSS added to the head:

    <script type="text/javascript">
    			window._wpemojiSettings = {"baseUrl":"http:\/\/\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/\/wp\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.2"}};
    			!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);
    		<style type="text/css">
    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;
Viewing 7 replies - 46 through 52 (of 52 total)
  • Moderator Marius L. J.


    Since we haven’t beaten this thread to death yet, I’d like to give you all some additional reading resources:

    The trojan emoji

    Don’t let the title scare you 🙂 It’s about why the emoji support is important, not because of the fancy smiles (although some of them can be quite humorous), but because of the underlying database changes.

    This is one of the many reasons updating WordPress is not fun.

    remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 );
    remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ );

    Just reposting what has worked for me.

    @ajonez that code just worked perfectly for me also. Always prefer functions.php to a plugin if I can avoid it…

    In case anyone is interested, adding the following to functions.php:

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

    .. shaved 0.05s of my average load time. Every little helps…

    Thank you for that code snippet to remove that!

    We discovered a serious problem with the emoji-script while loading content with ajax. On IE11 inserting the loaded content (about 40 <divs> with some child-nodes) took ~20 seconds. Using the profiler (via the f12 developer tools) we discovered that the emojii script was taking ~19 seconds to execute while inserting the nodes.
    We removed the script with the code mentioned above and the content now inserts in about 0.3 seconds.
    We will try to see why this is happening.


    Andrew Nevins


    WCLDN 2018 Contributor | Volunteer support

    The forum guidelines still apply, create your own thread to discuss your own issues:

Viewing 7 replies - 46 through 52 (of 52 total)
  • The topic ‘Emoji and smiley js and css added to head’ is closed to new replies.