Disable WordPress Emoji to Improve Page Load Speed

disable wordpress emojiimprove wordpress load speedremove emoji scriptwordpress performance optimizationdisable emojis plugin
Published·Modified·

While using Baidu Page Optimization suggestions, I noticed my blog was loading an unfamiliar JS file. After searching, I found this was caused by the WordPress version upgrade to 4.2. WordPress 4.2 introduced support for Emoji expressions, and using these expressions loads resources from outside the Great Firewall, which may affect your blog's loading speed.

emoji_js

emojiscreenshot

Emoji expressions

If you want to remove Emoji expressions, I have collected three methods from the internet to disable them. You can choose any one of these methods to solve your problem.

Method 1: Add the following code to your theme's functions.php file

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' );

Method 2: Different code, still add to your theme's functions.php file

/**
 * Disable the emoji's
 */
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_action( 'init', 'disable_emojis' );

/**
 * Filter function used to remove the tinymce emoji plugin.
 */
function disable_emojis_tinymce( $plugins ) {
    if ( is_array( $plugins ) ) {
        return array_diff( $plugins, array( 'wpemoji' ) );
    } else {
        return array();
    }
}

Method 3: Use the Disable Emojis plugin to solve the problem

If you are not familiar with code or are afraid of making mistakes, you can simply install the Disable Emojis plugin to solve this issue. Download here: Disable Emojis Plugin

Finally, you can check the website source code (Ctrl+U) and search for the keyword "wp-emoji-release.min.js". If no results are found, the Emoji expressions have been successfully disabled.