This page redirects to an external site: https://developer.wordpress.org/reference/functions/add_user_to_blog/
Grants the specified user permissions of the specified role on the specified blog.
<?php add_user_to_blog($blog_id, $user_id, $role); ?>
<?php
$userid = 1;
$blogid = 5;
$role = 'administrator';
if ( add_user_to_blog( $blogid, $userid, $role ) ) {
echo 'Added user '.$userid.' as '.$role.' to blog '.$blogid.'.';
} else {
echo 'Failed to add user '.$userid.' as '.$role.' to blog '.$blogid.'.';
}
?>
Executes the add_user_to_blog action prior to switching back to the current blog with restore_current_blog().