Checks whether username is valid.
Note: this function attempts to sanitize the username, and if it "passes", the name is considered valid. For additional logic, you can use the 'validate_username' hook.
<?php validate_username( $username ) ?>
<?php if (!empty($_POST['username']) && validate_username($_POST['username'])) { // Go ahead and save the user... } ?>
Since: 2.0.1
Before 3.0
validate_username() is located in wp-includes/registration.php.
After 3.0
validate_username() is located in wp-includes/user.php.