Is it possible to do something to WP so that I'm able to use the e-mail address as username?

I do not want to download a plugin for this.

  • I'm not sure if the WP's user registration page allows it, but the wp_insert_user_() function certainly does... I did this for a newsletter registration system, where each subscriber has the email assigned as name – onetrickpony Nov 10 '11 at 14:04

You can easily do this, all you have to do is create a user registration page and have the email address field fill both the username and email args to use for the wp_insert_user() function.

  • Any chance of WP misbehaving when doing this? – Steven Nov 10 '11 at 17:17

WordPress uses the following function when creating users:


Sanitize username stripping out unsafe characters.

If $strict is true, only alphanumeric characters plus these: _, space, ., -, *, and @ are returned.

Removes tags, octets, entities, and if strict is enabled, will remove all non-ASCII characters. After sanitizing, it passes the username, raw username (the username in the parameter), and the strict parameter as parameters for the filter.

Short answer: Not without a plugin.

Source: http://codex.wordpress.org/Function_Reference/sanitize_user

  • can't I create my own username sanitazion in functions.php that overrides the one WP is using by deafult? – Steven Nov 11 '11 at 8:24
  • You're going to do it within a theme or edit the default functions.php? – Sterling Hamilton Nov 11 '11 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.