今日WordPress发布了最新的WordPress 6.7版本,同时搬主题也及时发布了更新信息,但是没想到,WordPress 6.7有个bug,将会导致部分主题及插件的本地化翻译失效。
针对升级到WordPress 6.7版本的小伙伴,有可能在搬主题下载的主题及插件,安装了汉化语言包后还是不显示中文,建议尝试降级到WordPress 6.6.2版本,或者只能等待这些主题或插件官方更新修复了。
WordPress官方不少人都反应了该问题,官方也进行了解释:
WordPress now warns developers if they are loading translations too early in a plugin or theme, before the current user is known. Existing functions like load_plugin_textdomain() and load_theme_textdomain() were updated to defer the actual loading to the existing just-in-time translation logic in core. This reduces the likelihood of triggering the warning, and even improves performance in some situations by avoiding loading translations if they are not needed on a given page.
Reminder: if your plugin or theme is hosted on WordPress.org and is still using load_*_textdomain(), you can remove this call. Since WordPress 4.6, plugins and themes no longer need load_plugin_textdomain() or load_theme_textdomain(). WordPress automatically loads the translations for you when needed. If you still support older WordPress versions or do not host your plugin/theme on WordPress.org, move the function call to a later hook such as init.
When attempting to load translations before after_setup_theme or init, WordPress tries to load the current user earlier than usual, without giving other plugins a chance to potentially hook into the process. It also prevents any plugins from filtering translation calls, e.g. for switching the locale or file location. Hence the addition of this warning to call out this unexpected behavior.
一些说明的链接:
https://core.trac.wordpress.org/ticket/62337
https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/
https://wordpress.org/support/topic/translations-and-styling-gone-after-wp-6-7-update/
![图片[1]-WordPress 升级6.7版本要注意 本地化翻译会失效-搬主题](https://cdn.banzhuti.com/2024/11/20241114203728890.png)
























暂无评论内容