registration_errors filter-hookWP 2.1.0

Filters the errors encountered when a new user is being registered.

The filtered WP_Error object may, for example, contain errors for an invalid or existing username or email address. A WP_Error object should always be returned, but may or may not contain errors.

If any errors are present in $errors, this will abort the user's registration.

Usage

add_filter( 'registration_errors', 'wp_kama_registration_errors_filter', 10, 3 );

/**
 * Function for `registration_errors` filter-hook.
 * 
 * @param WP_Error $errors               A WP_Error object containing any errors encountered during registration.
 * @param string   $sanitized_user_login User's username after it has been sanitized.
 * @param string   $user_email           User's email.
 *
 * @return WP_Error
 */
function wp_kama_registration_errors_filter( $errors, $sanitized_user_login, $user_email ){

	// filter...
	return $errors;
}
$errors(WP_Error)
A WP_Error object containing any errors encountered during registration.
$sanitized_user_login(string)
User's username after it has been sanitized.
$user_email(string)
User's email.

Changelog

Since 2.1.0 Introduced.

Where the hook is called

register_new_user()
registration_errors
wp-includes/user.php 3362
$errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );

Where the hook is used in WordPress

Usage not found.