WP emoji stuff #1

Open
opened 2018-06-02 13:51:49 +00:00 by bhtooefr · 1 comment
bhtooefr commented 2018-06-02 13:51:49 +00:00 (Migrated from github.com)

So, WordPress is bringing in JavaScript for emojis, and is pulling the emojis from s.w.org. This is completely unacceptable. And, this isn't a theme thing, this is actually a WordPress-level thing.

I can kill the emojis by putting these code snippets in (source):

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

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

However, that won't update with changes to WordPress, if it's needed.

Alternately, I can advise the end user to install a plugin that does the same thing, such as Ryan Hellyer's Disable Emojis plugin. Or, maybe they just want to remove remote emoji downloading, and are fine with an emoji compression plugin. Or, maybe they want to revert to the old WordPress emoji.

Thoughts on how I should accomplish this?

So, WordPress is bringing in JavaScript for emojis, and is *pulling the emojis from s.w.org*. This is completely unacceptable. And, this isn't a theme thing, this is actually a WordPress-level thing. I can kill the emojis by putting these code snippets in ([source](https://stackoverflow.com/questions/29960915/strange-text-before-my-header-wordpress)): ``` function disable_emojicons_tinymce( $plugins ) { if ( is_array( $plugins ) ) { return array_diff( $plugins, array( 'wpemoji' ) ); } else { return array(); } } 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' ); ``` However, that won't update with changes to WordPress, if it's needed. Alternately, I can advise the end user to install a plugin that does the same thing, such as Ryan Hellyer's [Disable Emojis](https://wordpress.org/plugins/disable-emojis/) plugin. Or, maybe they just want to remove remote emoji downloading, and are fine with an emoji compression plugin. Or, maybe they want to revert to the old WordPress emoji. Thoughts on how I should accomplish this?
bhtooefr commented 2018-06-02 14:23:01 +00:00 (Migrated from github.com)

Worth noting that I've gone ahead and incorporated that (as well as add_filter( 'emoji_svg_url', '__return_false' ); in disable_wp_emoticons()) in my local copy of the theme, but I am awaiting feedback before I push that.

It is worth noting that this is allegedly a graceful degrade capability for emoji, but, like... how many browsers don't support Unicode emoji, but can take Unicode emoji being polyfilled by JavaScript, and are actually spending time on the public internet in 2018?

Worth noting that I've gone ahead and incorporated that (as well as `add_filter( 'emoji_svg_url', '__return_false' );` in `disable_wp_emoticons()`) in my local copy of the theme, but I am awaiting feedback before I push that. It is worth noting that this is allegedly a graceful degrade capability for emoji, but, like... how many browsers don't support Unicode emoji, but can take Unicode emoji being polyfilled by JavaScript, and are actually spending time on the public internet in 2018?
Sign in to join this conversation.
No description provided.