Description

Filter the field's "placeholder" property.


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


Parameters

$placeholder

(string) (required) The field placeholder

Default: The field placeholder


$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 placeholder of a field based on the language if the WPML plugin is installed:

 

add_filter( 'vfbp_field_placeholder', 'filter_vfbp_field_placeholder', 10, 3 );

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

	// the ICL_LANGUAGE_CODE constant is part of the WPML plugin (wpml.org)
	if ( ICL_LANGUAGE_CODE == 'en' )
		$placeholder = 'Enter text here';
	elseif ( ICL_LANGUAGE_CODE == 'fr' )
		$placeholder = 'Entrez le texte ici';

	return $placeholder;
}