How to Remove WordPress Emoji Bloat From the Header (Without Plugins)

A stylized flat vector web page icon featuring a smiley face in the header being crossed out. Text: REMOVE WP EMOJI.

View your WordPress page source and you will find a block of emoji JavaScript and CSS sitting in the <head>, loaded on every page. Core injects it for emoji support, but modern browsers render emoji on their own, so it is safe to strip out. This DevAnswers guide removes it with a functions.php snippet, no plugin required.

Remove the Emoji Code 

Add the snippet below to your theme’s functions.php (use a child theme or a code snippets plugin so a theme update will not wipe it; see where to add code in WordPress). Prefer not to touch code? The free Disable Emojis plugin does the same job.

functions.php
function devans_disable_emojis() {
    // Detection script: front end, admin, and oEmbed pages
    remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'embed_head', 'print_emoji_detection_script' );
    // Emoji styles: older hook plus the newer enqueue used by current WordPress
    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' );
    // Feeds and email
    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' );
    // Classic editor plugin and CDN prefetch
    add_filter( 'tiny_mce_plugins', 'devans_disable_emojis_tinymce' );
    add_filter( 'emoji_svg_url', '__return_false' );
}
add_action( 'init', 'devans_disable_emojis' );

function devans_disable_emojis_tinymce( $plugins ) {
    return is_array( $plugins ) ? array_diff( $plugins, array( 'wpemoji' ) ) : array();
}

The function runs on init, early enough to unhook everything before WordPress builds the head. The 7 on the first line matters: core registers print_emoji_detection_script on wp_head at priority 7, and remove_action only matches when you pass the same priority. Save the file and reload your site, and the emoji detection script and its styles are gone from the page head.

What Each Line Does 

The print_emoji_detection_script removals take core’s inline detection script off wp_head, the admin screens, and embed_head (the last one covers oEmbed pages, added in WordPress 4.4). For the CSS, older WordPress printed it through print_emoji_styles, which WordPress later deprecated in favor of wp_enqueue_emoji_styles, so the snippet removes both.

add_filter( 'emoji_svg_url', '__return_false' ) drops the DNS prefetch to the emoji CDN, so the browser no longer reaches out to s.w.org. The tiny_mce_plugins filter removes the wpemoji plugin from the classic editor. The three remove_filter lines turn off the emoji handling WordPress applies to feed and email content; leave them in for completeness even if you do not use either.

Why the Emoji Code Is There, and Safe to Remove 

WordPress added emoji support in version 4.2 (April 2015) so an emoji looked the same on an old desktop as on a new phone. Back then, plenty of systems could not draw the newer characters, so WordPress shipped a fallback that swapped them for images.

To decide whether the fallback is needed, it injects the window._wpemojiSettings detection script into the head through wp_head on every page load. The script runs a small canvas test, drawing an emoji and checking whether the browser rendered it natively or needs replacement images from the WordPress.org CDN at s.w.org. That test, the inline script, and the emoji CSS load on every page, even ones with no emoji at all.

Today every major browser and operating system renders emoji natively, so the fallback is doing work that is no longer needed. Removing it does not change how emoji display to your visitors. It simply trims the inline code, the CSS, and a possible third-party request out of your head, leaving the source cleaner and slightly lighter.

Verify It Is Gone 

Reload a page, open View Page Source, and search for _wpemojiSettings. It should no longer be there, and neither should the inline emoji CSS block. The head will be visibly shorter. If you run a caching plugin or a page cache, clear it first so you are looking at fresh output rather than a stored copy from before the change.

Keep your expectations realistic: this is a small optimization, not a dramatic speed boost. The win is a cleaner head, less inline code on every request, and one fewer third-party dependency, which is worth having on a site you are tuning, but it will not transform your scores on its own.

Summary 

The emoji bloat is core WordPress, not your theme, and it is safe to drop because browsers handle emoji themselves. Add the snippet to functions.php (or install the Disable Emojis plugin) to remove the detection script, the styles, the wpemoji editor plugin and the CDN prefetch, then confirm by searching the page source for _wpemojiSettings. While you are tidying the head, you can also fix a missing title tag.

Support DevAnswers
Written, tested and maintained by one developer. Your support keeps these guides accurate and ad-light.
Buy me a coffee

Comments

Leave a reply