wpcf7_get_validation_error_reference()CF7 1.0

Returns a reference key to a validation error message.

Хуков нет.

Возвращает

Строку. Reference key code.

Использование

wpcf7_get_validation_error_reference( $name, $unit_tag );
$name(строка) (обязательный)
Name of form control.
$unit_tag(строка)
Unit tag of the contact form.
По умолчанию: ''

Код wpcf7_get_validation_error_reference() CF7 5.6.3

function wpcf7_get_validation_error_reference( $name, $unit_tag = '' ) {
	if ( '' === $unit_tag ) {
		$contact_form = wpcf7_get_current_contact_form();

		if ( $contact_form and $contact_form->validation_error( $name ) ) {
			$unit_tag = $contact_form->unit_tag();
		} else {
			return null;
		}
	}

	return preg_replace( '/[^0-9a-z_-]+/i', '',
		sprintf(
			'%1$s-ve-%2$s',
			$unit_tag,
			$name
		)
	);
}