$user_email =
sanitize_email( $user_email );
if ( empty( $user_name ) ) { $errors->
add( 'user_name',
__( 'Please enter a username.'
) );
} $illegal_names =
get_site_option( 'illegal_names'
);
if ( !
is_array( $illegal_names ) ) { $illegal_names = array
( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator'
);
add_site_option( 'illegal_names',
$illegal_names );
} if ( in_array( $user_name,
$illegal_names, true
) ) { $errors->
add( 'user_name',
__( 'Sorry, that username is not allowed.'
) );
} /** This filter is documented in wp-includes/user.php */
$illegal_logins =
(array) apply_filters( 'illegal_user_logins', array
() );
if ( in_array( strtolower( $user_name ),
array_map( 'strtolower',
$illegal_logins ), true
) ) { $errors->
add( 'user_name',
__( 'Sorry, that username is not allowed.'
) );
}