Skip Navigation

Open

Reported for: WPML Multilingual CMS 4.6.13

Topic Tags: Bug

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:
    	private function remove_field_name_from_start( $field_name, $field_id_string ) {
    		return preg_replace( '#' . $field_name . '-?#', '', $field_id_string, 1 );
    	}
    
  • With:
    	private function remove_field_name_from_start( $field_name, $field_id_string ) {
    		return preg_replace( '#' . preg_quote($field_name) . '-?#', '', $field_id_string, 1 );
    	}
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>