Эта тема решена. Вот описание проблемы и ее решения.
Problem:
After installing the WPML plugin and activating languages, everything works except when logging in as an administrator, which triggers a fatal error. The error message indicates an issue with DOMDocument::loadHTML() due to an empty argument in the WPML String Translation plugin.
Solution:
We recommend two approaches to resolve this issue:
1. Disable automatic string registration by navigating to WPML → String Translation and turning off the “Auto register untranslated strings” option.
2. Apply a manual fix in the plugin. Navigate to: wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php and update the function
readAllRawGettextStringsFromHtmlScriptTags
as follows:
private function readAllRawGettextStringsFromHtmlScriptTags( \DOMDocument $dom, string $html ): array {<br /> // We cannot read here with xpath - script tags contain code from the JS template engines and some html will be broken.<br /> // (For example some elements will miss closing tags).<br /> $pattern = '/<script.*?type="text\/(?:html|template)".*?>([\s\S]*?)<\/script>/i';<br /> preg_match_all( $pattern, $html, $matches );<br /> $scriptHtmls = [];<br /> foreach ( $matches[1] as $match ) {<br /> if (!empty($match)) {<br /> $scriptHtmls[] = $match;<br /> }<br /> }Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum.
Это форум технической поддержки WPML – плагина для многоязычной WordPress.
Доступно для чтения всем, но только клиенты, купившие WPML, могут оставлять сообщения. Сотрудники WPML отвечают на сообщения форума 6 дней в неделю, 22 часов в сутки.
Эта тема содержит 1 ответ, имеет 0 voices.
Последнее обновление: 1 месяц назад.
При содействии: Andrey.