5

I updated my to the new wordpress version yesterday and since then, I have this weird text on top of my website, just above the header, where the toolbar should be.

window._wpemojiSettings = {
   "baseUrl": "http:\/\/s.w.org\/images\/core\/emoji\/72x72\/",
   "ext": ".png",
   "source": {
     "concatemoji": "http:\/\/localhost\/wordpress\/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);

Does anyone have a clue?

3
  • This seems to be some part of the emoji code that was integrated with 4.2. Do you see this in the site source or is it real output to the front?
    – flomei
    Apr 30, 2015 at 7:00
  • If I press ctrl+u I see this code placed in my header between a javascript declaration, it has as well its own css. Oh, and it appears only in my homepage, which in my case is index.php. When I navigate through my site, the other pages don't have it. Apr 30, 2015 at 7:08
  • Then it´s the emoji integration (s.w.org leads to WordPress) that came with version 4.2. Have a look at the information about 4.2 and if you want to, just google for "remove emoji wordpress 4.2." to get rid of them.
    – flomei
    Apr 30, 2015 at 7:11

4 Answers 4

9

We will hook into init and remove actions as follows:

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

We will need the following filter function to disable TinyMCE emojicons:

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

Now we breathe and pretend this feature was never added to core... particularly while tons of resolved bugs are yet to be implemented.

This is available as a plugin, Disable Emojis.

Alternatively, you can replace the smilies with the original versions from previous versions of WordPress using Classic Smilies.

PS: I tried to flag this question as a duplicate of 185577

0
4

in your theme's function.php file add below line and it will work as you expect,

// REMOVE WP EMOJI
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' );
3

Since WordPress emoji are served from s.w.org and they are not compressed, this impacts the SVG loading time depending on how many emoji you are using, and can even throw warnings on Google’s PageSpeed Insights tool.

To fix this issue, you can serve the emoji directly from your WordPress site itself and not by making external calls through js.

This can be achieved by installing the plugin Compressed Emoji which is available for free in the WordPress.org plugin repository.

When the plugin is activated, the compression offers savings in the range of 3kb ~ 1.3kb (roughly %60) per emoji.

Source: WPTavern

0

Thanks to all for your suggestions, you can either remove emoji or compress it from wordpress. for me removal works by just adding some code snippet .. for more follow http://www.notesonclick.com/blog/remove-wordpress-emoji-code/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.