- 状态
- 已解决
- 报告针对
- WPML Multilingual CMS 4.6.12
- 解决于
- WPML 4.7
- 相关插件/主题
- Divi
- 主题标签
- Compatibility
问题概述
您可能会遇到这样的问题:在使用 WPML 和 Divi 主题 将翻译完成至 100% 后,页面未被标记为已翻译。此外,可能会记录以下错误:
PHP Fatal error: Uncaught TypeError: htmlspecialchars_decode(): Argument #1 ($string) must be of type string, array given in .../wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/strategy/shortcode/class-wpml-pb-update-shortcodes-in-content.php:203
临时解决方法
在继续操作前,请确保拥有完整的站点备份。
- 打开 …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/strategy/shortcode/class-wpml-pb-update-shortcodes-in-content.php 文件。
- 找到第 206 行。
- 替换:
if ( 'allow_html_tags' !== $encoding ) { $translation = htmlspecialchars( htmlspecialchars_decode( $translation ) ); } - 替换为:
// Ensure $translation is a string if (is_array($translation)) { // Handle array to string conversion as needed $translation = implode('', $translation); } if ( 'allow_html_tags' !== $encoding ) { $translation = htmlspecialchars( htmlspecialchars_decode( $translation ) ); }