WordPress has included built-in emoji support since version 4.2. While well-intentioned, the implementation adds a JavaScript detection script, an inline stylesheet, and a DNS prefetch hint to every page on your site, even if you never use a single emoji. For most professional WordPress sites, this is unnecessary overhead that clutters your page source and adds avoidable HTTP requests.
This snippet completely removes the WordPress emoji system from both the front end and the admin, including its presence in RSS feeds and outgoing emails.
The Code
Add this to your functions.php or a site-specific plugin. Everything runs inside an init action hook to ensure the necessary functions and filters are available.
What Gets Removed
The snippet removes several separate hooks that the WordPress emoji system attaches itself to:
The print_emoji_detection_script function outputs an inline JavaScript block in the <head> that detects whether the browser supports emoji natively. If it doesn’t, WordPress loads an SVG sprite sheet from its CDN. Removing this eliminates the script entirely and prevents the conditional CDN load.
The print_emoji_styles function outputs a small inline <style> block that sets img.emoji display properties. It’s tiny, but it’s still unnecessary markup when emoji aren’t being used.
The wp_staticize_emoji filter converts any emoji characters in post content and comment RSS feeds into inline <img> tags pointing to the WordPress SVG CDN. Removing it means emoji in feeds appear as their native Unicode characters instead, which is the correct behavior for modern feed readers.
The wp_staticize_emoji_for_email filter does the same for outgoing wp_mail() emails. Removing it keeps email content clean and avoids external image loads in email clients.
The wpemoji TinyMCE plugin is the classic editor’s emoji picker. Removing it from the plugin list disables the picker in the admin editor without affecting the editor’s other functionality.
Finally, the wp_resource_hints filter removal strips the dns-prefetch hint for the WordPress emoji CDN from the page <head>.
Will This Break Emoji?
No. Modern operating systems and browsers, including all versions of macOS, iOS, Android, and Windows 10 and later, render Unicode emoji natively without any JavaScript assistance. Any emoji characters you type in your content will still display correctly for the vast majority of users. The WordPress emoji script only existed to add fallback support for very old browsers that lacked native emoji rendering, which is no longer a practical concern.
When to Use This
This is a safe, low-risk optimization for virtually any WordPress site. It’s particularly valuable on sites focused on page speed scores, sites with strict Content Security Policies, or sites where a clean, minimal page source matters.
add_action( 'init', function() {
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_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
add_filter( 'tiny_mce_plugins', function( $plugins ) {
return array_diff( $plugins, [ 'wpemoji' ] );
} );
add_filter( 'wp_resource_hints', function( $urls, $relation_type ) {
if ( $relation_type === 'dns-prefetch' ) {
$emoji_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/14.0.0/svg/' );
$urls = array_values( array_diff( $urls, [ $emoji_url ] ) );
}
return $urls;
}, 10, 2 );
} );
