add_user_to_blog ( $blog_id, $user_id, $role )

  • (int) blog_id ID of the blog the user is being added to.
  • (int) user_id ID of the user being added.
  • (string) role User role.
  • (true|WP_Error) True on success or a WP_Error object if the user doesn't exist or could not be added.
Defined at:
Change Log:
  • M: U


Adds a user to a blog, along with specifying the user's role.Use the {@see 'add_user_to_blog'} action to fire an event when users are added to a blog.

Related Functions

add_new_user_to_blog, add_existing_user_to_blog, get_users_of_blog, add_user_meta, maybe_add_existing_user_to_blog

Top Google Results

User discussions

wpseek mobile