WPDev.one
Core Function
View Source on Trac ↗

add_user_to_blog()

add_user_to_blog( mixed $blog_id, mixed $user_id, mixed $role )

Adds a user to a blog, along with specifying the user's role.

Parameters 3 required

Name / Type Description
$blog_id
int

ID of the blog the user is being added to.

Required
$user_id
int

ID of the user being added.

Required
$role
string

User role.

Required

Return Value

((true)
(true | WP_Error) True on success or a WP_Error object if the user doesn't exist or could not be added.

Function Information

Since Version
MU (3.0.0)
Source File
wp-includes/ms-functions.php
Advertisement