WPML
SignaturePHP
apply_filters( 'wpml_tm_save_translation_cf', array $field, string $fieldname, array $data )

Description

WPML applies this hook filter on custom field values when a translation is saved either via the translation editor screen or via an XLIFF import. The custom field value is in this way made available to external themes and plugins for further manipulation before saving e.g. encoding or substitution.

Arguments

  • $fieldarrayOptional

    The current custom field array
  • $fieldnamestringOptional

    The custom field name
  • $dataarrayOptional

    The data array being processed through the filter

Example Usage

A basic examplePHP
add_filter('wpml_tm_save_translation_cf', 'callback_2', 10, 3);

function callback_2($field, $fieldname, $data) {

  // some super code which ENCODES values in $field
  // eg
  $field['data'] = base64_encode($field['data']);

  return $field;
}