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

In a multisite setup, you can associate an existing user in the network to a site. The standard wp_insert_user function doesn't seem to have the proper logic to handle. How would I do this for multisite?

Also, is there a way to see if a given user is already associated with a particular site?

share|improve this question
up vote 2 down vote accepted

After looking the code the create user, i found that that I can do:

$userdata = get_user_by('login', 'user1'); 
add_existing_user_to_blog( array( 'user_id' => $userdata->ID, 'role' => 'author'));

Fix: was missing closing )

share|improve this answer

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.