Function: add_user_to_blog

add_user_to_blog( integer $blog_id, integer $user_id, string $role )

Adds a user to a blog.

Use the \'add_user_to_blog' action to fire an event when users are added to a blog.


Name Type(s) Default Value Description
$blog_id integer

ID of the blog you're adding the user to.

$user_id integer

ID of the user you're adding.

$role string

The role you want the user to have


true | WP_Error

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.