Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When creating a user in Wordpress an email address is required for that user. The website I'm working on requires that users remain anonymous (it's part of a research study) and I'd consider email to be an identifying piece of data. Users will be added manually, so email is not required to confirm accounts or prevent spam sign-ups.

Am I going to have to provide a fake email address for each account, or is there a way to leave this field blank?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

It's possible, just no so easily via the Users page without some hackery.

The WordPress API will let you insert users without email addresses, so a little custom plugin to accept a login name and password, and a call to wp_insert_user or wp_update_user should work for you. Unfortunately I don't have time to code it up for you, but perhaps this will point you in a direction.

$userdata = array ('user_login' => 'someuser', 'user_pass' => 'swordfish');
$new_user_id = wp_update_user( $userdata );
share|improve this answer
    
Thanks! I was creating users with wp_insert_user() and, after seeing the email column is set to refuse nulls in the database, assumed that the issue was with not providing an email address. After you pointed out that an email is not required by the WordPress API I discovered the true source of the problem. –  Mike Wheaton Jul 13 '11 at 16:34
add comment

According to WordPress' documentation, wp_create_user also let's you insert users without e-mail, as it is an optional parameter. All you need to do is provide a unique username and a password.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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