【wordpress】写文章发布添加标签时出现编辑器错误TypeError: Cannot read properties of undefined (reading ‘most_used’)
本文最后更新于14 天前,其中的信息可能已经过时,如有错误请发送邮件到fupcode@outlook.com

问题描述

使用6.6.1版本写文章发布,点击下图红框处添加标签时,编辑器立马报错

控制台报错TypeError: Cannot read properties of undefined (reading ‘most_used’)

bug定位

找到报错的代码处,发现竟然是一个h3标签渲染报错

(0,T.jsx)(Tn.BaseControl.VisualLabel, {
    as: "h3",
    className: "editor-post-taxonomies__flat-term-most-used-label",
    children: t.labels.most_used
})

根据className可以判断这只是一个静态提示标签,内容应该为“常用标签”,可是t.labels.most_used却没有定义,利用断点调试查看t的内容

t = { 
    description: "",
    hierarchical: false,
    name: "标签",
    rest_base: "tags",
    rest_namespace: "wp/v2",
    slug: "post_tag"
}

不是,哥们,连labels都没有,我不知道是我的问题还是wordpress的问题。

解决方案一

简单粗暴地更改js文件,找到wordpress目录下的wp-includes/js/dist/editor.min.js,搜索

children:t.labels.most_used

改为

children:"常用标签"

效果为

解决方案二

不使用该功能,先发布文章再修改标签,或者使用旧版编辑器

总结

很离谱的bug,我试过回退版本到6.6,问题依然存在,在论坛上搜索过,似乎只有我遇到了这个问题,尝试向官方论坛反映中……

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇