Email is an important part of user management. I suspect it would be very difficult to entirely remove it’s requirement. However, I don’t think it generally has to be a valid email, only of a valid form. Whether it really works doesn’t normally matter. I’ve added several users to my test installation, which isn’t even capable of sending e-mails. Obviously, the reset password and similar functions that require functional email do not work.
Simply provide an email such as [email protected]. Won’t matter if it doesn’t receive mail. There’s surely a way to even auto-populate the field regardless if a user provides one or not.
But completely remove it’s requirement? Good luck with that. 😉
Not possible. It’s like your ID to enter the best club in town!
It is no problem when creating and updating a user programmatically with
wp_create_user() and wp_update_user()
but not with the forms.
I had a second look in the code and found a way to let you even udpate the user with the user edit form in the admin panel without the user having an email address or even deleting the email address:
this code deleted the error message for empty emails from the error object and if there are no errors, the form is saved
put this into functions.php or in your plugin
add_action( 'user_profile_update_errors', 'remove_empty_email_error' );
function remove_empty_email_error( $arg ) {
if ( !empty( $arg->errors['empty_email'] ) ) unset( $arg->errors['empty_email'] );
}
Danke @webzunft
This seems to work, but only on the update screen.
It does not seem to change the behavior of the add new user screen.
Anyone have any ideas?
@summit
strange, because it is basically the same function to create and edit users. I currently don’t run the project I developed this for and so can’t test it. Sorry.
This will work if you are comfortable with coding:
You can simply create your own user creation page in the front end and use wp_create_user() function to insert them.
Then use webzunft’s code for them to edit their user afterward.
I would add captcha and other checks to keep from getting spammed too badly also.
@webzunft –> Thank you much for the code; its perfect for what I was looking to do.