remove_role() WordPress Function

This function allows you to remove a role from a user. You can use it to remove any unwanted roles that a user may have.

remove_role( string $role ) #

Removes a role, if it exists.


Parameters

$role

(string)(Required)Role name.


Top ↑

Source

File: wp-includes/capabilities.php

function remove_role( $role ) {
	wp_roles()->remove_role( $role );
}


Top ↑

Changelog

Changelog
VersionDescription
2.0.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.