Skip to content

Disable Emojis 😎 Everywhere (code snippet)

All modern browsers support 😍 emoji icons. They work by default without any JavaScript, CSS and image substitutes.

However, WordPress tries to replace all emojis with image substitutes. This is done in order to be consistent across all devices and operating systems. So emojis look the same for your site visitors on all devices.

The problem is an additional JavaScript file, inline CSS, and an image file for each replaced emoji. Those files (with the exception of image replacements) will be loaded even on pages without any emojis.

The solution is to disable Emojis in WordPress.

Watch tutorial on YouTube.

Benefits:

  • Remove unnecessary CSS, JavaScript and 3rd party images.
  • Increase page load speed.
  • Emojis are handled by browsers.
  • Consistent behavior in admin and front end.

Code snippet ✂️

/**
* Disable the emoji's
*/
function veppa_disable_emojis() {
	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', 'veppa_disable_emojis_tinymce' );
	add_filter( 'wp_resource_hints', 'veppa_disable_emojis_remove_dns_prefetch', 10, 2 );
	wp_deregister_style( 'wp-emoji-styles' );
	wp_deregister_style( 'wp-emoji-styles-inline-css' );
	
}
add_action( 'init', 'veppa_disable_emojis',999999 );

/**
* Filter function used to remove the tinymce emoji plugin.
* 
* @param array $plugins 
* @return array Difference betwen the two arrays
*/
function veppa_disable_emojis_tinymce( $plugins ) {
	if ( is_array( $plugins ) ) {
		return array_diff( $plugins, array( 'wpemoji' ) );
	} else {
		return array();
	}
}

/**
* Remove emoji CDN hostname from DNS prefetching hints.
*
* @param array $urls URLs to print for resource hints.
* @param string $relation_type The relation type the URLs are printed for.
* @return array Difference betwen the two arrays.
*/
function veppa_disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
	if ( 'dns-prefetch' == $relation_type ) {
		// Strip out any URLs referencing the WordPress.org emoji location
		$emoji_svg_url_bit = 'https://s.w.org/images/core/emoji/';
		foreach ( $urls as $key => $url ) {
			if ( strpos( $url, $emoji_svg_url_bit ) !== false ) {
				unset( $urls[$key] );
			}
		}
	}
	return $urls;
}

add_filter( 'script_loader_src', 'veppa_disable_emojis_js_src', 10, 2 );
function veppa_disable_emojis_js_src( $src, $handle ){
	switch($handle){
		case 'wpemoji':
		case 'twemoji':
		case 'concatemoji':
			return '';
		break;
	}
	return $src;
}

add_filter( 'wp_inline_script_attributes', 'veppa_disable_emojis_js_type', 10, 2 );
function veppa_disable_emojis_js_type( $attributes, $data ){
	if(strpos($data,'veppa_disable_emojis_js_type')===false && stripos($data,'_wpemojiSettings')!==false ){
		$attributes['type'] = 'do-not-run';
	}
	return $attributes;
}

What is the difference from the “Disable Emojis” plugin?

Disable Emojis Plugin does not work everywhere in admin area.

Disable emojis” plugin is great but it does not disable emojis everywhere inside WordPress admin area. See screenshot above.

How WordPress Emojis effect PageSpeed?

I have tested if WordPress emojis affect PageSpeed. Here is the report for home page of my website with 5 emoji icons.

PageSpeed score report when using 3rd party WordPress emoji images.

As you can see from the report screenshot, the PageSpeed score does not change and stays at 100. (watch how easy I get from 65 score to 100)

But report shows that page loaded 5 images from WordPress (external, 3rd party) website.

It is advised to reduce 3rd party dependencies as much as possible. So disabling WordPress emojis will be good for website performance.

What is the problem with 3rd party resources?

Apart from slowing down your website, 3rd party resources are not reliable. They may not always work as expected.

Corporate (internal) website will not load 3rd party (external) resource. It will give error after trying to load for some time.

For example, a corporate (internal) website will not load 3rd party (external) resources and will give an error. As seen on screenshot.

Page load will be slow because the browser will try to load unreachable 3rd party resource.

3rd party resources have 3 main problems:

  1. Speed — the page will load slower when the resource reachable and very slow (10-30 seconds) when resource is not reachable.
  2. Error — when a 3rd party resource is not reachable.
  3. Privacy — a 3rd party server will log the referrer URL (exact website URL that you visited), your IP address, browser and operating system details, and the time when you accessed the website.

For these reasons, it is advised to remove or replace external resources as much as possible.

How emojis rendered in different Operating Systems?

Emoji rendered different depending on Operating System. (year 2025)

Here is how the 😆🔥🐍🦁 emoji looks on Windows 11 and Android 13 in the year 2025.

It will also look different over the years.

What is next:

 

Leave a Reply

Your email address will not be published. Required fields are marked *