wp_revoke_user() WordPress Function

The wp_revoke_user() function is used to revoke a user's access to a WordPress site. This function can be used to revoke a user's access to a specific site or to revoke a user's access to all sites in a WordPress network.

wp_revoke_user( int $id ) #

Remove all capabilities from user.


Parameters

$id

(int)(Required)User ID.


Top ↑

Source

File: wp-admin/includes/user.php

function wp_revoke_user( $id ) {
	$id = (int) $id;

	$user = new WP_User( $id );
	$user->remove_all_caps();
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.