WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to allow a user to have multiple email addresses associated with their account. update_user_meta() will not work because it will overwrite the current email. add_user_meta() wouldn't work either because it would duplicate the entry, even if it is the same email address.. Any ideas?

share|improve this question
up vote 0 down vote accepted

You can use update_user_meta() and add_user_meta(), just store all the email addresses in an array in a new field. If you have a requirement, such as preventing duplicates, run a validation function that checks for that before updating the database.

share|improve this answer
Is there some validator function native to wordpress, similar to update_user_meta() checking for duplicate keys. Is there something that looks for the value? – Greg Wiley Sep 12 '12 at 19:58
Not to WordPress, but you can accomplish that particular validation with PHP's array_unique function: php.net/manual/en/function.array-unique.php – NightHawk Sep 12 '12 at 20:23
Thanks for your help. – Greg Wiley Sep 12 '12 at 20:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.