禁用 Emoji 表情
打开当前wordpress主题下的functions.php文件,加入以下代码即可:
/**
* 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.
*
* @param array $plugins
* @return array Difference betwen the two arrays
*/
function disable_emojis_tinymce( $plugins ) {
return array_diff( $plugins, array( 'wpemoji' ) );
屏蔽头部加载 s.w.org
WordPress 默认使用 s.w.org 下的图片来渲染 emoji 表情,所以在 WordPress 头部也有 s.w.org 的DNS 解析:
<link rel='dns-prefetch' href='//s.w.org'>
但是 s.w.org 国内根本无法访问,所以这里 DNS 预解析,反而可能会影响速度,并且我们已经禁用 Emoji 功能,最好也在头部禁止 s.w.org 的DNS 解析,在 functions.php 中加载下面这行代码即可:
add_filter( 'emoji_svg_url', '__return_false' );
- QQ群:253510359
- 建议:VPS商家层出不穷,根据需要购买,切莫剁剁剁!
- 评测:很多VPS虽已评测,但网络环境改变稳定性,速度也会随之改变.评测只能作为一般性参考.不负任何法律,道义责任.
- 申明:所有vps,域名,服务器优惠信息均来自网络公开内容,由于水平有限不免有谬误.请以官方为准.