availability:

WPML Version: 3.3.1

description:

Filter the hidden input field rendered by the wpml_add_language_form_field hook.

type:
filter
category:
Site-Wide Language Information
parameters:
add_filter( 'wpml_language_form_input_field', callable $function_to_add, 10, 2 );
$function_to_add
(callable) (Required) Your callback to be run when the filter is applied.

There are two parameters being passed to this filter: the language form field and the current language.

  • $language_form_field => The language form field
  • $current_language => The current language

This filter must return a string of $language_form_field.

hook example usage:

Example

add_filter( 'wpml_language_form_input_field', 'my_filter_function', 10, 2 ); 

function my_filter_function( $language_form_field, $current_language ) {
	$language_form_field = $language_form_field . sprintf( __( 'The hidden language field lang = %s.', 'text-domain' ), $current_language);
	return $language_form_field;
}

// The expected result is like the following line 
// <input type='hidden' name='lang' value='es' />The hidden language field lang = es.
do_action( 'wpml_add_language_form_field' );