Description

Filter the field's Name property.


Changing this value will alter the label that is displayed and will most commonly be used by WPML users.


Parameters

$name

(string) (required) The field name

Default: The field name


$field_id

(int) (optional) The field ID

Default: the field ID


$form_id

(int) (optional) The form ID

Default: the form ID


Examples

Change the name of a field based on the language if the WPML plugin is installed:

  

add_filter( 'vfbp_field_name', 'filter_vfbp_field_name', 10, 3 );

function filter_vfbp_field_name( $name, $field_id, $form_id ){    
	// if the WPML plugin is not installed, return the default field name
	if ( !defined( 'ICL_LANGUAGE_CODE' ) )
		return $name;

	// the ICL_LANGUAGE_CODE constant is part of the WPML plugin (wpml.org)
	if ( ICL_LANGUAGE_CODE == 'en' )
		$name = 'Your Name';
	elseif ( ICL_LANGUAGE_CODE == 'fr' )
		$name = 'Votre nom';

	return $name;
}