apply_filters( 'wpml_tm_save_translation_cf', array $field, string $fieldname, array $data )
- Type
- filter
- Category
- Miscellaneous
- 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.
Arguments
- $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
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;
}
Related hooks
icl_ls_languages, wpml_sync_custom_field_copied_value, wpml_ls_enable_ajax_navigation, wpml_element_type, wpml_setting, wpml_sub_setting, wpml_exclude_post_from_auto_translate, wpml_forms_config_ninja-forms, wpml_forms_config_wpforms, wpml_tf_feedback_open_link