In this post, I’ll walk you through the process of turning off WordPress’s emojis and speeding up the loading of your blog. By default, WordPress loads stylesheets and scripts for emojis, so you can see them on the website. However, you can prevent this script from loading altogether and still display the default browser emojis for users.
How to Disable Emojis in WordPress without a plugin?
In the functions.php file of your theme, insert the following code to disable the emojis. An other option for managing these codes is to utilize any code manager plugin.
function 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', 'disable_emojis_tinymce' );
add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
}
add_action( 'init', 'disable_emojis' );
function disable_emojis_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
if ( 'dns-prefetch' == $relation_type ) {
$emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' );
$urls = array_diff( $urls, array( $emoji_svg_url ) );
}
return $urls;
}
How to disable Emojis in WordPress using the Litespeed cache plugin?
If you are using the LiteSpeed cache plugin, you can do that with a single Click.
Just Go to the Litespeed Page optimization option and under that click on the HTML settings.
You’ve now been able to prevent the WordPress website’s Emojis script from loading.
This article has shown you how to turn off emojis on your WordPress website. Please feel free to ask me questions in the comments area if you have any questions about this.