add_user_to_blog
add_user_to_blog ( $blog_id, $user_id, $role )
Parameters:- (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.
Returns:- (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: - Introduced in WordPress: —
- Deprecated in WordPress: —
Description
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.