ACF_Form_User::filter_registration_errors()publicACF 5.8.1

filter_registration_errors

Validates $_POST data and appends any errors to prevent new user registration.

{} Это метод класса: ACF_Form_User{}

Хуков нет.

Возвращает

WP_Error.

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

$ACF_Form_User = new ACF_Form_User();
$ACF_Form_User->filter_registration_errors( $errors, $sanitized_user_login, $user_email );
$errors(WP_Error) (обязательный)
A WP_Error object containing any errors encountered during registration.
$sanitized_user_login(строка) (обязательный)
User's username after it has been sanitized.
$user_email(строка) (обязательный)
User's email.

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

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

Код ACF_Form_User::filter_registration_errors() ACF 5.10.2

function filter_registration_errors( $errors, $sanitized_user_login, $user_email ) {
	if ( ! acf_validate_save_post() ) {
		$acf_errors = acf_get_validation_errors();
		foreach ( $acf_errors as $acf_error ) {
			$errors->add(
				acf_idify( $acf_error['input'] ),
				acf_esc_html( acf_punctify( sprintf( __( '<strong>Error</strong>: %s', 'acf' ), $acf_error['message'] ) ) )
			);
		}
	}
	return $errors;
}