Skip Navigation

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.

Our wait time is higher than usual, please make sure you are meeting the minimum requirement - https://wpml.org/home/minimum-requirements before you report issues, and if you can take a look at current Known Issues - https://wpml.org/known-issues/. Thank you.
Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

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

Tagged: 

This topic contains 2 replies, has 0 voices.

Last updated by Bruno Kos 1 day, 11 hours ago.

Assisted by: Bruno Kos.

Author Posts
April 25, 2025 at 10:04 am #16967645

adelineP-2

Background of the issue:
I am trying to translate a Saved Layout created with the Visual Portfolio plugin on my WordPress website. The error prevents me from accessing the WPML translation editor. Link to a page where the issue can be seen: hidden link

Symptoms:
PHP Fatal error: Uncaught TypeError: strtr(): Argument #1 ($string) must be of type string, array given in /wp-content/plugins/sitepress-multilingual-cms/classes/utilities/Labels.php on line 26. The issue happens when attempting to open the translation editor, likely due to a field or label that is not a plain string. I expected to see the Gallery Saved layout without Title H2, but instead, I got an H2 Title under the photos. The layout is not good.

Questions:
Why is WPML expecting a string but receiving an array?
How can I fix the fatal error to access the WPML translation editor?

April 26, 2025 at 7:43 am #16970397

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

I was able to reproduce this issue here:
hidden link

I got:

Fatal error: Uncaught TypeError: strtr(): Argument #1 ($string) must be of type string, array given in /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/utilities/Labels.php:26
Stack trace:
#0 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/utilities/Labels.php(26): strtr()
#1 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php(599): WPML\Utilities\Labels::labelize()
#2 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php(335): WPML_TM_Xliff_Writer->get_extra_data()
#3 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php(312): WPML_TM_Xliff_Writer->process_elements()
#4 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php(117): WPML_TM_Xliff_Writer->get_job_translation_units_data()
#5 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php(575): WPML_TM_Xliff_Writer->generate_job_xliff()
#6 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php(548): wpml_tm_get_job_xliff()
#7 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/menu/translation-queue/CloneJobs.php(74): wpml_tm_create_ATE_job_creation_model()
#8 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/editor/Editor.php(312): WPML\TM\Menu\TranslationQueue\CloneJobs->cloneWPMLJob()
#9 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/editor/Editor.php(169): WPML\TM\Editor\Editor->createATECounterpartForExistingWPMLJob()
#10 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(207): WPML\TM\Editor\Editor->WPML\TM\Editor\{closure}()
#11 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(257): WPML\FP\Right->map()
#12 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/editor/Editor.php(175): WPML\FP\Right->chain()
#13 [internal function]: WPML\TM\Editor\Editor->WPML\TM\Editor\{closure}()
#14 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array()
#15 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Logic.php(40): WPML\FP\{closure}()
#16 [internal function]: WPML\FP\Logic::WPML\FP\{closure}()
#17 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array()
#18 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(207): WPML\FP\{closure}()
#19 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/editor/Editor.php(107): WPML\FP\Right->map()
#20 /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/menu/translation-queue/class-wpml-translations-queue.php(52): WPML\TM\Editor\Editor->open()
#21 /var/www/sites/onyx-drumbox/wp-includes/class-wp-hook.php(324): WPML_Translations_Queue->load()
#22 /var/www/sites/onyx-drumbox/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#23 /var/www/sites/onyx-drumbox/wp-includes/plugin.php(517): WP_Hook->do_action()
#24 /var/www/sites/onyx-drumbox/wp-admin/includes/class-wp-screen.php(424): do_action()
#25 /var/www/sites/onyx-drumbox/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen()
#26 /var/www/sites/onyx-drumbox/wp-admin/admin.php(213): set_current_screen()
#27 {main}
thrown in /var/www/sites/onyx-drumbox/wp-content/plugins/sitepress-multilingual-cms/classes/utilities/Labels.php on line 26

This has been escalated to our Compatibility team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you.

April 29, 2025 at 4:30 am #16977083

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

The custom field `vp_images` was originally set to be translatable, but it should actually be set to "Copy". Since this field contains an array (not a single string), it caused the error: "must be of type string, array given."

Here’s how to fix it:

1. Go to WPML > Settings > Custom Fields.
2. Find `vp_images` and change its translation preference to Copy (or Copy once).
3. Navigate to WPML > Translation Management > Jobs, and trash the translation job that is currently in progress.
4. Go back to the original post/page, resave it, and then create a new translation.

This will ensure everything works properly without errors.

Let me know if this helped!

image1.png
image.png