Skip Navigation
availability:

WPML Version: 3.2

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.

Note: This hook requires the WPML Translation Management module

type:
filter
category:
Miscellaneous
parameters:
apply_filters( 'wpml_tm_save_translation_cf', array $field, string $fieldname, array $data )
$field
(array) (Optional) The current custom field array
$fieldname
(string) (Optional) The custom field name
$data
(array) (Optional) The data array being processed through the filter
hook example usage:

A basic example

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;
}