Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 1 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
add comment

Your Answer

 
discard

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.