Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Kyiv (GMT+02:00)

This topic contains 3 replies, has 0 voices.

Last updated by Andrey 1 day, 9 hours ago.

Assisted by: Andrey.

Author Posts
November 6, 2025 at 3:49 pm #17554719

johannesG-17

Background of the issue:
I migrated my website from Server A to Server B. I am trying to load my page, but the layout is damaged. Inside the logs, I get an error related to the WPML plugin.

Symptoms:
PHP Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php:31

Questions:
Why is my website layout damaged after migration?
How can I fix the PHP fatal error related to DOMDocument::loadHTML()?

November 6, 2025 at 4:04 pm #17554785

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for contacting WPML support.

Could you please provide more details on how you migrated your website?

Based on your description, here are some possible causes of the issue:
• Missing or corrupted data: The string data that WPML expects might be missing from the database or have become corrupted during migration.
• Encoding issues: Incorrect character encoding could prevent the DOMDocument class from interpreting the string as valid HTML.

Could you also check and share the collation settings of your database tables?

I recommend re-migrating your site using a migration plugin such as All-in-One WP Migration or Duplicator. These tools ensure an exact copy of your site (including the database and all fields) is properly transferred to the new server.

November 7, 2025 at 10:30 pm #17558779

johannesG-17

Hello,

we used All-inOne WP Migration. We can confirm that the website is running without any issues except string translation:

NOTICE: PHP message: PHP Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php:31
Stack trace:
#0 /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php(31): DOMDocument->loadHTML('', 8260)
#1 /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php(190): WPML\StringTranslation\Infrastructure\StringHtml\Repository\HtmlStringsRepository->loadHtml('')
#2 /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php(221): WPML\StringTranslation\Infrastructure\StringHtml\Repository\HtmlStringsRepository->readAllRawGettextStringsFromHtmlScriptTags(Object(DOMDocument), '<!DOCTYPE html>...')
#3 /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php(237): WPML\StringTranslation\Infrastructure\StringHtml\Repository\HtmlStringsRepository->readAllRawGettextStringsFromHtml(Object(DOMDocument), '<!DOCTYPE html>...')
#4 /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php(251): WPML\StringTranslation\Infrastructure\StringHtml\Repository\HtmlStringsRepository->readAllGettextStringsFromHtml(Object(DOMDocument), '<!DOCTYPE html>...')
#5 /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Application/StringHtml/Service/HtmlStringsService.php(75): WPML\StringTranslation\Infrastructure\StringHtml\Repository\HtmlStringsRepository->getAllStringsFromHtml('<!DOCTYPE html>...')
#6 /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Application/StringHtml/Service/HtmlStringsService.php(66): WPML\StringTranslation\Application\StringHtml\Service\HtmlStringsService->extractStringsFromHtml('<!DOCTYPE html>...')
#7 [internal function]: WPML\StringTranslation\Application\StringHtml\Service\HtmlStringsService->readHtmlFromBuffer('<!DOCTYPE html>...', 9)
#8 /var/www/html/wp-includes/functions.php(5471): ob_end_flush()
#9 /var/www/html/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all('')
#10 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#11 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#12 /var/www/html/wp-includes/load.php(1304): do_action('shutdown')
#13 [internal function]: shutdown_action_hook()
#14 {main}
thrown in /var/www/html/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Repository/HtmlStringsRepository.php on line 31

November 10, 2025 at 12:20 pm #17562262

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for your feedback.

I suggest, just in case, manually uploading fresh copies of the WPML plugins from your account: https://wpml.org/account/downloads/.

Does the same issue occur if you temporarily disable all plugins except WPML plugin?

If the issue persists, I’ll need to request temporary access (wp-admin and FTP) to your site—preferably to a staging or test site where the problem can be replicated.

When you log in to leave your next reply, you’ll find the required fields below the comment area. The information you enter is private, meaning only you and I can see and access it.

Please also include the exact steps to replicate the issue so I can investigate it more efficiently.