Wednesday, March 8, 2017

How to remove emoji support in wordpress to load website faster


Emoji are small animated smiles which replaces text based emoticons like :-)
They look beautiful but they eats few of your bandwidth and hence load time when their support is loaded with webpage.

If you are concerned about your website speed, consider disabling them.

Add below function in your function.php file of child theme of Genesis Framework.

function bt_remove_emoji() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_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', 'bt_remove_tinymce_emoji' );
}
add_action( 'init', 'bt_remove_emoji' );

function bt_remove_tinymce_emoji( $plugins ) {

if ( ! is_array( $plugins ) ) {
return array();
}

return array_diff( $plugins, array( 'wpemoji' ) );
}

No comments:

Post a Comment