WPML
apply_filters( $custom_field_val, $custom_field_name )
Type
filter
WPML Version
4.1.0

Description

Custom fields can be encoded in a format that WPML does not understand. Those fields have to be decoded and encoded before WPML can translate them. To achieve this, the wpml_decode_custom_field and wpml_encode_custom_field filters must be used. These filters can be used if there is additional custom encoding besides the ones already handled by WPML.

Arguments

$custom_field_val
Value contained within field that needs to be encoded
$custom_field_name
Name of the field that needs to be encoded

Example usage

Example
add_filter( 'wpml_encode_custom_field', 'my_encode_function', 10, 2 );

function my_encode_function( $custom_field_val, $custom_field_name ) {
   if ( $custom_field_name === 'my-special-field' ) {
      $custom_field_val = my_special_encoding_function( $custom_field_val );
   }

  return $custom_field_val;
}

wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages

All 29 Site-Wide Language Information hooks →