Run a family-friendly site and want to make sure no inappropriate words end up in usernames? Use this
add_filter( 'validate_username', 'forbidden_username_terms', 10, 2); function forbidden_username_terms($valid, $username) { $badwords = array('badword','nogood'); foreach($badwords as $bw) { if (strpos($username,$bw) !== false) return false; } return $username; }