Wordpress - User Without Email?
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 );
Using Wordpress 4.7.2, I solved this with the following hooks:
// This will suppress empty email errors when submitting the user form
add_action('user_profile_update_errors', 'my_user_profile_update_errors', 10, 3 );
function my_user_profile_update_errors($errors, $update, $user) {
$errors->remove('empty_email');
}
// This will remove javascript required validation for email input
// It will also remove the '(required)' text in the label
// Works for new user, user profile and edit user forms
add_action('user_new_form', 'my_user_new_form', 10, 1);
add_action('show_user_profile', 'my_user_new_form', 10, 1);
add_action('edit_user_profile', 'my_user_new_form', 10, 1);
function my_user_new_form($form_type) {
?>
<script type="text/javascript">
jQuery('#email').closest('tr').removeClass('form-required').find('.description').remove();
// Uncheck send new user email option by default
<?php if (isset($form_type) && $form_type === 'add-new-user') : ?>
jQuery('#send_user_notification').removeAttr('checked');
<?php endif; ?>
</script>
<?php
}
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.