Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Disable emojis in WordPress without a plugin

Remove the WordPress emoji script and styles with a few lines of code. The Snipfire snippet covers almost everything the Disable Emojis plugin does.

What Disable Emojis (GDPR friendly) does

Disable Emojis removes the emoji script, styles and related code that WordPress loads for older browsers. The plugin on WordPress.org

What the snippet does the same

  • The emoji detection script and emoji styles no longer load, on the site or in the admin.
  • Emoji in feeds and emails are no longer swapped for images.
  • There is no DNS prefetch to the WordPress.org emoji server, and emoji still show in every current browser.

What's different

  • The plugin also removes the emoji add-on from the classic editor (TinyMCE). The snippet doesn't, which only matters if you write in the classic editor.

When to keep the plugin Keep the plugin if you write in the classic editor and want its emoji add-on gone too.

The snippet: Remove the emoji script and styles

Stops WordPress from loading its emoji script and styles on every page. Every current browser shows emoji on its own.

PHP
<?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' );
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_emoji_styles' );
remove_action( 'admin_enqueue_scripts', 'wp_enqueue_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' );
// No DNS prefetch for the emoji images either.
add_filter( 'emoji_svg_url', '__return_false' );

Notes, where it runs and what it was tested with

Switching from the plugin

  1. Install the snippet in Snipfire (it arrives switched off).
  2. Deactivate Disable Emojis (GDPR friendly).
  3. Switch the snippet on. Snipfire checks the code and test-loads your site first.
  4. Check the page it affects, then delete the plugin.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.