WPML
Статус
Решено
Заявлено для
WPML Multilingual CMS 4.6.12
Решено в
WPML 4.7
Связанный плагин/тема
Divi
Теги темы
Compatibility

Обзор проблемы

Вы можете столкнуться с проблемой, при которой страницы не отмечаются как переведенные после завершения перевода на 100% при использовании WPML с темой оформления Divi. Кроме того, в журнале может быть зарегистрирована следующая ошибка:

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 ) );
    		}

Все известные проблемы →