桃子

人生如梦,人生如茶...

  • 首页
  • 分类
    • 闲言碎语
    • 聆听
    • 软件分享
    • 亿次元&COS
    • 精品文摘
    • 说一说
    • 相册
  • 友链
  • 网盘
  • 说一说
  • 登录
登录
账号

密码

解决WordPress出现"Failed to load plugin:wpemoji"问题
2022年 02月 26 日

ssr

前天老蒋在群里有看到网友在登录WordPress后台编辑器更新文章的时候有出现"Failed to load plugin:wpemoji"问题提示。然后搜索相关问题确实还是没有见到,但是从提示上看应该是在加载wpemoji的时候错误,可能是某个文件没有加载出来导致的。那问题如何解决呢?
第一、禁用 Emoji 功能

/
Disable the emoji Edit By itbulu.com
/
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 ) {<br> if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}

这功能用户一般用不上,我们就禁止掉。
第二、本地化设置
WordPress 在有些旧版本浏览器为了兼容显示Emoji 表情图标,它会调用 http://s.w.org/images/core/emoji/72x72/ 目录下的图片渲染Emoji 表情图标。由于网络问题会无法加载。我们可以将这个目录本地化后直接用脚本替换本地化。

//Emoji 本地化 Edit By itbulu.com
function smilies_reset() {
global $wpsmiliestrans, $wp_smiliessearch;
// don't bother setting up smilies if they are disabled
if (!get_option('use_smilies')) {
return;
}
$wpsmiliestrans_fixed = array(<br> ':mrgreen:' => "\xf0\x9f\x98\xa2",<br> ':smile:' => "\xf0\x9f\x98\xa3",<br> ':roll:' => "\xf0\x9f\x98\xa4",<br> ':sad:' => "\xf0\x9f\x98\xa6",<br> ':arrow:' => "\xf0\x9f\x98\x83",<br> ':-(' => "\xf0\x9f\x98\x82",<br> ':-)' => "\xf0\x9f\x98\x81",<br> ':(' => "\xf0\x9f\x98\xa7",<br> ':)' => "\xf0\x9f\x98\xa8",<br> ':?:' => "\xf0\x9f\x98\x84",<br> ':!:' => "\xf0\x9f\x98\x85",<br> );<br> $wpsmiliestrans = array_merge($wpsmiliestrans, $wpsmiliestrans_fixed);
}
//替换cdn路径
function static_emoji_url() {
return get_bloginfo('template_directory').'/72x72/';
}
//让文章内容和评论支持 emoji 并禁用 emoji 加载的乱七八糟的脚本
function reset_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');
add_filter('the_content', 'wp_staticize_emoji');
add_filter('comment_text', 'wp_staticize_emoji',50); //在转换为表情后再转为静态图片
smilies_reset();
add_filter('emoji_url', 'static_emoji_url');
}
add_action('init', 'reset_emojis');
//输出表情
function fa_get_wpsmiliestrans(){
global $wpsmiliestrans;<br> $wpsmilies = array_unique($wpsmiliestrans);<br> foreach($wpsmilies as $alt => $src_path){
$emoji = str_replace(array('&#x', ';'), '', wp_encode_emoji($src_path));
$output .= '<a class="add-smily" data-smilies="'.$alt.'">

解决WordPress出现"Failed to load plugin:wpemoji"问题

2022-02-26 | 软件分享 |

前天老蒋在群里有看到网友在登录WordPress后台编辑器更新文章的时候有出现"Failed to load plugin:wpemoji"问题提示。然后搜索相关问题确实还是没有见到,但是从提示上看应该是在加载wpemoji的时候错误,可能是某个文件没有加载出来导致的。那问题如何解决呢?
第一、禁用 Emoji 功能

/
Disable the emoji Edit By itbulu.com
/
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 ) {<br> if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}

这功能用户一般用不上,我们就禁止掉。
第二、本地化设置
WordPress 在有些旧版本浏览器为了兼容显示Emoji 表情图标,它会调用 http://s.w.org/images/core/emoji/72x72/ 目录下的图片渲染Emoji 表情图标。由于网络问题会无法加载。我们可以将这个目录本地化后直接用脚本替换本地化。

//Emoji 本地化 Edit By itbulu.com
function smilies_reset() {
global $wpsmiliestrans, $wp_smiliessearch;
// don't bother setting up smilies if they are disabled
if (!get_option('use_smilies')) {
return;
}
$wpsmiliestrans_fixed = array(<br> ':mrgreen:' => "\xf0\x9f\x98\xa2",<br> ':smile:' => "\xf0\x9f\x98\xa3",<br> ':roll:' => "\xf0\x9f\x98\xa4",<br> ':sad:' => "\xf0\x9f\x98\xa6",<br> ':arrow:' => "\xf0\x9f\x98\x83",<br> ':-(' => "\xf0\x9f\x98\x82",<br> ':-)' => "\xf0\x9f\x98\x81",<br> ':(' => "\xf0\x9f\x98\xa7",<br> ':)' => "\xf0\x9f\x98\xa8",<br> ':?:' => "\xf0\x9f\x98\x84",<br> ':!:' => "\xf0\x9f\x98\x85",<br> );<br> $wpsmiliestrans = array_merge($wpsmiliestrans, $wpsmiliestrans_fixed);
}
//替换cdn路径
function static_emoji_url() {
return get_bloginfo('template_directory').'/72x72/';
}
//让文章内容和评论支持 emoji 并禁用 emoji 加载的乱七八糟的脚本
function reset_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');
add_filter('the_content', 'wp_staticize_emoji');
add_filter('comment_text', 'wp_staticize_emoji',50); //在转换为表情后再转为静态图片
smilies_reset();
add_filter('emoji_url', 'static_emoji_url');
}
add_action('init', 'reset_emojis');
//输出表情
function fa_get_wpsmiliestrans(){
global $wpsmiliestrans;<br> $wpsmilies = array_unique($wpsmiliestrans);<br> foreach($wpsmilies as $alt => $src_path){
$emoji = str_replace(array('&#x', ';'), '', wp_encode_emoji($src_path));
$output .= '<a class="add-smily" data-smilies="'.$alt.'">
她也许还在54
她也许还在54
  • 2022-02-02
人生感悟17条
人生感悟17条
  • 2022-01-23
晚放心语:真正的伶仃不是一小我私人寥寂,而是在无尽的喧嚣中损失了自我
晚放心语:真正的伶仃不是一小我私人寥寂,而是在无尽的喧嚣中损失了自我
  • 2022-01-22
2023年,新年兔年桌面壁纸
2023年,新年兔年桌面壁纸
  • 2023-01-23
上一篇
ZBLOG PHP自动调用文章首张图片和随机调用代码
下一篇
WordPress获取网站文章中所有图片代码方法
赞 (0)
分享
QQ
微信
打赏
您的大名:
万水千山总是情,给个打赏行不行。 打赏

评论区


取消回复

发表评论

36+13=?

暂无评论,要不来一发?

搜索
分类
  • 闲言碎语
    188
  • 聆听
    666
  • 软件分享
    991
  • 亿次元&COS
    178
  • 精品文摘
    4544
  • 说一说
    61
  • 相册
    6
热评文章
  • typecho插入bilibili视频播放器 B站插件
  • 风筝误-刘珂矣
  • 怎么戒烟了
  • 说说功能测试
  • 欢迎使用 Typecho
  • 女生和男生的区别
  • 隔岸花
  • 测试听
  • 秋天最后的绿草
  • TYPECHO-孤独-主题
最新回复
2023-01-30 22:05
看透一切的博士生 在《帮助反馈》发表了评论:
你好能请教一下楼主博客页面的网盘页面是用的什么技术 方便分享一下吗
2023-01-28 23:12
admin 在《给网页HTML添加访问密码才能访问,三种代码方法》发表了评论:
安全没有问题的,我自己测试过
2023-01-25 13:15
能 在《2023年,新年兔年桌面壁纸》发表了评论:
好
2023-01-20 15:15
说话风趣的蓝领 在《给网页HTML添加访问密码才能访问,三种代码方法》发表了评论:
୧(๑•̀⌄•́๑)૭ 中文测试
2023-01-02 13:16
admin 在《2022.12.25》发表了评论:
???没明白
友情链接
    桃子
      规则之树
        子云社区
          远方博客
            随心记
              推荐网站
                注册账号 | 帮助反馈 | 站点推荐
                © 2023 桃子.
                由 Typecho 强力驱动 | www.taozi1.com
                湘ICP备18006110号
                回到顶部
                微信分享二维码

                微信里点“发现”,扫一下
                二维码便可将本文分享至朋友圈。