禁用 WordPress 的 Emoji 功能

/ 3,136 阅读 / 0

昨天在发文的时候无意中添加了一个表情 🙂,结果发文后发现 Emoji 表情显示不了,用 Chrome 的检查看了一下,原来 WordPress Emoji 的实现方式是调用 http://s.w.org/images/core/emoji/72x72/ 下的图片来渲染 Emoji。

这个地址是国内访问不了的。

而且个人觉得没多大用途,干脆就禁用掉了。


禁用方法

在当前主题的 functions.php 文件中添加如下代码:

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_action('embed_head', 'print_emoji_detection_script');

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

保存,上传覆盖便可。

如果你像我一样使用了子主题功能,那就把上面的代码复制粘贴到子主题的 functions.php 文件中,保存上传覆盖便可。

怎么修改 Lingonberry 主题子主题的 functions.php 点这里

记得备份原文件。

404 Not Found

404

Not Found

The resource requested could not be found on this server!


Proudly powered by LiteSpeed Web Server

Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.