Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
When saving a page's CSS in a translated page using Cornerstone, the function

copy_meta_fields

does not properly handle the slashing of values before passing them to

update_post_meta

. This results in incorrect unslashing of characters like '\n' to 'n', causing data corruption.
Solution:
The issue stems from the Cornerstone save routine, not WPML. The correct fix should be implemented in Cornerstone's translation layer. Modify the function

cs_update_serialized_post_meta

in the file

\wp-content\themes\pro\cornerstone\includes\functions\helpers.php

. Here is the corrected function:

function cs_update_serialized_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '', $allow_revision_updates = false, $filter = '' ) {
 
    if ( is_array( $meta_value ) && apply_filters( 'cornerstone_store_as_json', true ) ) {
        $meta_value = cs_json_encode( $meta_value );
    }
 
    $meta_value = wp_slash( $meta_value );
 
  if ( $filter ) {
    $meta_value = apply_filters( $filter, $meta_value );
  }
 
  if ( $allow_revision_updates ) {
    return update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value );
  }
 
    return update_post_meta( $post_id, $meta_key, $meta_value, $prev_value );
 
}

This modification ensures that values are properly slashed before being saved, preventing data corruption. This issue needs to be solved by the Cornerstone Team, a future update would overwrite such a patch. If this solution does not resolve your issue or seems irrelevant due to updates or different circumstances, please check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If issues persist, we highly recommend opening a new support ticket at WPML support forum.

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.

This topic contains 15 replies, has 0 voices.

Last updated by Andreas W. 1 month, 3 weeks ago.

Assisted by: Andreas W..

Author Posts
January 27, 2026 at 7:57 am #17765468

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

The compatibility team confirmed my findings and approved the proposed fix as a possible solution for the issue.

They further confirmed that this is not a WPML issue, and we would kindly like to ask you to contact the Themeco Team about this issue.