WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/remove user from blog

Description

Removes a user from a blog.

Accepts an optional $reassign parameter, if you want to reassign the user's blog posts to another user upon removal.

Usage

<?php remove_user_from_blog$user_id$blog_id$reassign ); ?>

Parameters

$user_id
(integer) (required) ID of user to remove
Default: None
$blog_id
(integer) (required) ID of blog to remove user from
Default: None
$reassign
(string) (optional) a user to whom to reassign the removed user's posts
Default: empty string

Return Value

(WP_Error object|boolean) 
WP_Error object on failure, True on success

Examples

Remove user 243 from blog 3 and reassign their posts to user 2.

<?php

$user_id = 243;
$blog_id = 3;
$reassign = 2;

remove_user_from_blog( $user_id, $blog_id, $reassign );

?>

Notes

Use the 'remove_user_from_blog' action to fire an event when users are removed from a blog.

Change Log

Since: MU

Source File

remove_user_from_blog() is located in wp-includes/ms-functions.php

Related

Blog User Functions: add_user_to_blog(), add_new_user_to_blog(), remove_user_from_blog(), is_user_member_of_blog()

See also index of Function Reference and index of Template Tags.