Disable WordPress Emoji Emoticons to Improve Loading Speed

Publish: 2015-05-27 | Modify: 2017-06-21

When using the Baidu page optimization suggestions, I found that my blog loaded an unfamiliar JavaScript file. After searching, I learned that it was due to the WordPress version upgrade to 4.2. WordPress 4.2 added support for Emoji expressions, which will load resources from outside the wall after using these expressions, which may affect the loading speed of your blog.

emoji_js

emojiscreenshot

If you want to remove Emoji expressions, you can choose one of the following three methods to solve your problem.

Method 1: Add the following code to the functions.php file in your theme directory

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: Add the following code to the functions.php file in your theme directory

/**
 * 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 afraid of making mistakes when adding code, it's okay. You can directly install the Disable Emojis plugin to solve this problem. Click here to download: Disable Emojis plugin

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


Comments