Yoast_Input_Validation::get_the_error_description()public staticYoast 12.1

Gets the error description wrapped in a HTML paragraph.

Метод класса: Yoast_Input_Validation{}

Хуков нет.

Возвращает

Строку. The error description HTML or empty string.

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

$result = Yoast_Input_Validation::get_the_error_description( $error_code );
$error_code(строка) (обязательный)
Code of the error set via add_settings_error(), normally the variable name.

Список изменений

С версии 12.1 Введена.

Код Yoast_Input_Validation::get_the_error_description() Yoast 22.4

public static function get_the_error_description( $error_code ) {
	$error_description = self::get_error_description( $error_code );

	if ( self::yoast_form_control_has_error( $error_code ) && $error_description ) {
		return '<p id="' . esc_attr( $error_code ) . '-error-description" class="yoast-input-validation__error-description">' . $error_description . '</p>';
	}

	return '';
}