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?
It’s possible, just not so easily via the Users page without some hackery.
The WordPress Function wp_create_user 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
orwp_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.Update for people looking for a solution with the REST-API:
Unfortunately, this is not possible by the rest-api. the email is required there. see: https://developer.wordpress.org/rest-api/reference/users/#create-a-user
Using WordPress 4.7.2, I solved this with the following hooks:
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.This is a pretty old question, but is still relevant.
Anyway, @Milo definitely had the right idea.
Here is what I use and it works great. This is very convenient when you want to create users, but prefer to keep your wordpress backend on lockdown. For example if you have a blog and prefer your content authors submit their work to you, this enables you create a user for them while not actually giving them access. Or if you prefer to blog under an alias. Or it’s even useful for testing purposes or I guess those “sketchy” people who want to make up a bunch of fake users for their site (you know who you are).
Add this to functions.php temporarily or use it with a useful plugin like code snippets.
If you are looking to update users from the backend after creating them, add this and you’ll avoid getting the error/warning notification.
If you’d rather use a plugin this one will do the job most likely:
https://wordpress.org/plugins/allow-multiple-accounts/
The “Import Users from CSV” plugin will allow you to create users with no email address. I added them with…
Our club leverages the WordPress wp_users database, but we need to have on file even those members who have no email
I find a way on youtube , when I search “how to create users without email in wordpress” !
4.Enter this code: