从 WordPress4.2 之后,WordPress 前台页面就会自动加载 Emoji 表情,这可能会导致有些网站的自定义表情错误,所以,下面让我一起来学习如何将禁用 WordPress 加载 Emoji 表情吧。

functions.php加入以下代码:

/*
禁用 WordPress 加载 Emoji 表情
https://www.zhutihome.net/
*/
remove_action( 'admin_print_scripts' , 'print_emoji_detection_script');
remove_action( 'admin_print_styles' , 'print_emoji_styles');
remove_action( 'wp_head' , 'print_emoji_detection_script', 7);
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');

参与评论