虚位以待(AD)
虚位以待(AD)
首页 > CMS教程 > WordPress > 移除wordpress中的表情颜文字CONCATEMOJI

移除wordpress中的表情颜文字CONCATEMOJI
类别:WordPress   作者:码皇   来源:互联网   点击:

如果你更新了WordPress 最新版本的4 2 版本,查看网页源代码你会发现WordPress 会自动在加载一段用于支持emjo 表情的脚本(JS+CSS),对于大部分人来说,这个是十分鸡肋的功能,反而影响加载速度。但看部分加载源居然 ,魔客吧

如果你更新了WordPress 最新版本的4.2 版本,查看网页源代码你会发现WordPress 会自动在加载一段用于支持emjo 表情的脚本(JS+CSS),对于大部分人来说,这个是十分鸡肋的功能,反而影响加载速度。但看部分加载源居然是wp.org的js 文件(wp.org 有被墙否?)


去除方法:在主题目录下 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.
*/
function disable_emojis_tinymce( $plugins ) {
return array_diff( $plugins, array( ‘wpemoji’ ) );
}

相关热词搜索: 移除wordpress中的表情颜文字CONCATEMOJI