Open
Reported for: WPML Multilingual CMS 4.6.13
Overview of the issue
Custom fields with complex keys (e.g., containing special characters like pipes |
) may not translate properly in WPML. This results in translated values being stored as serialized arrays instead of simple strings, causing issues with displaying translated custom field values.
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open …/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php file.
- Look for line 260.
- Replace:
123
private
function
remove_field_name_from_start(
$field_name
,
$field_id_string
) {
return
preg_replace(
'#'
.
$field_name
.
'-?#'
,
''
,
$field_id_string
, 1 );
}
- With:
123
private
function
remove_field_name_from_start(
$field_name
,
$field_id_string
) {
return
preg_replace(
'#'
. preg_quote(
$field_name
) .
'-?#'
,
''
,
$field_id_string
, 1 );
}