WordPress 简体中文版菜单“显示选项”无法点击,这个问题早在 8月24日 挖鱼源码网就发微博指出了问题所在,接着在 WordPress 圈也传播开来,但是依旧有新朋友不知道怎么解决,只好发布文章再说明下。
在 外观 – 菜单,点击右上角的“显示选项”无法打开:

问题所在如下微博内容所示:

admin-zh_CN.po 翻译错误导致 4.2 – 4.3 菜单设置的“显示选项”无法使用: To add a custom link, <strong>expand the Custom Links section, enter a URL and link text, and click Add to Menu</strong> 翻译的最后一个 </strong> 竟然是 <strong>,也就是这个没有闭合导致的
解决办法:
按照上面提到的问题所在,使用 poedit 这个软件,编辑 wp-content/languages 下的 admin-zh_CN.po,修复下翻译内容即可。或者如果你的是 WordPress 4.3.1 ,可以点击下载 admin-zh_CN 修复包,解压后上传覆盖即可。或者你可以直接添加下面的代码到当前主题的 functions.php 即可:
|
|
<span style="color: #000000; font-weight: bold;">function</span> Bing_fixed_zh_CN_display_option<span style="color: #009900;">(</span> <span style="color: #000088;">$translations</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domain</span> <span style="color: #009900;">)</span><span style="color: #009900;">{</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">(</span> get_locale<span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'zh_CN'</span> <span style="color: #339933;">&&</span> <span style="color: #000088;">$text</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'To add a custom link, <strong>expand the Custom Links section, enter a URL and link text, and click Add to Menu</strong>'</span> <span style="color: #339933;">&&</span> <span style="color: #000088;">$domain</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'default'</span> <span style="color: #009900;">)</span> <span style="color: #000088;">$translations</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'要添加自定义链接,<strong>展开自定义链接小节,输入URL和链接文本,然后点击添加到菜单</strong>'</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$translations</span><span style="color: #339933;">;</span> <span style="color: #009900;">}</span> add_action<span style="color: #009900;">(</span> <span style="color: #0000ff;">'gettext'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Bing_fixed_zh_CN_display_option'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span> |
|
function Bing_fixed_zh_CN_display_option( $translations, $text, $domain ){
if( get_locale() == ‘zh_CN’ && $text == ‘To add a custom link, <strong>expand the Custom Links section, enter a URL and link text, and click Add to Menu</strong>’ && $domain == ‘default’ ) $translations = ‘要添加自定义链接,<strong>展开自定义链接小节,输入URL和链接文本,然后点击添加到菜单</strong>’;
return $translations;
}
add_action( ‘gettext’, ‘Bing_fixed_zh_CN_display_option’, 10, 3 );
感谢@斌果 朋友提供代码。
赏 如果本文对你有帮助,请打赏作者,鼓励我们继续写作!
请先
!