WordPress禁用Emoji表情提升访问速度

事实上WordPress的这些小缺点也是可以解决的,关键就在于站长够不够勤奋,这里要说的是禁用Emoji表情的方法。

像我这种以文字为主的博客,评论也没有几个,Emoji表情是用不上了,又何必为了一个不常用的功能而牺牲性能呢?请看禁用Emoji表情代码:

function bzg_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' );
	remove_action( 'wp_head', 'wp_resource_hints', 2 );
}
add_action( 'init', 'bzg_disable_emojis' );

将以上代码丢到主题文件functions.php中