Wordpress - Allow Duplicate Email Address for Different Users

Unfortunately, this just isn't possible. There are three occasions where WordPress performs this check:

  1. When you click 'save' on the edit user screen( https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/user.php#L157 )
  2. When a user is registered ( https://github.com/WordPress/WordPress/blob/master/wp-includes/user.php#L2023 )
  3. When a user is created/inserted into the dtabase ( https://github.com/WordPress/WordPress/blob/master/wp-includes/user.php#L1610 )

Both (1) and (2) have hooks after them which allow you to remove any error message (added to an WP_Error() object), and so effectively by-passing the check.

Unfortunately both (1) and (2) call (indirectly) wp_insert_user(), and so (3). (There's a bit of maze of wp_insert_user(), wp_update_user() and wp_create_user() :))

(3) is the stumbling block. Simply put you can't get round it.

But even if you could, it's probably best not to. Since a unique e-mail is widely expected, you maybe be using plug-ins that rely on that fact. WordPress itself relies on this fact when you use the 'forgotten password' feature.

This leaves you with two options:

  • Create a 'fake' e-mail for child-accounts (but you'd need to be sure that the e-mail is fake given e-mail is fake - maybe use your domain?). Additionally you'd want to make absolutely sure that e-mails associated with such accounts are never used.
  • Abandon the "user" approach and using something like a CPT. But this would rewriting a hell of a lot of code, some of it relating to user security (i.e. logging in, password storage etc). It isn't really a sane choice.

Unfortunately WordPress isn't designed for user relationship management...