Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mbissett/4a3baefd31bab00535b4a45a5330d36f to your computer and use it in GitHub Desktop.
Save mbissett/4a3baefd31bab00535b4a45a5330d36f to your computer and use it in GitHub Desktop.

WordPress doesn't allow multiple users to share the same e-mail address, but there are certain plugins that change that behavior. This is an example workaround using the Allow Multiple Accounts plugin.

  1. Install and activate this plugin: https://wordpress.org/plugins/allow-multiple-accounts/

  2. Use a custom PHP function in the import to generate a fake e-mail for the imported user(s): [fake_email()]. Screenshot: https://d.pr/FREE/Yr0MOL.

  3. Store the real e-mail in a Custom Field named '_email_temp'. Screenshot: https://d.pr/ERw4F9

  4. Use our API to change the users e-mail to the real e-mail after the user is saved.

Here’s all of the code you’ll need to add inside the Function Editor via All Import -> Settings: https://d.pr/ef9JAn.

That’s it. Keep in mind that this code runs for all imports, so you might consider wrapping it in an if conditional based on the import ID ( which you can get from $_GET['id'] for manual runs or $_GET['import_id'] for cron job imports ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment