WordPress at a glance

remove_role() WP 2.0.0

Removes a role from WordPress.

These settings are saved in the database (wp_user_roles option of wp_options table), so it’s recommended to change them during activation/deactivation of a plugin or theme.

Works based on: wp_roles(), WP_Roles()

No Hooks.


Null. Nothing.


remove_role( $role );
$role(string) (required)
Role name. For example: administrator, editor, author, contributor, subscriber.


1. Remove role "subscriber":

register_deactivation_hook( __FILE__, 'myplugin_deactivate' );
function myplugin_deactivate(){
	remove_role( 'subscriber' );


Since 2.0.0 Introduced.

Code of remove role: wp-includes/capabilities.php WP 5.2.3

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

Related Functions

From tag: Roles capabilities

vladlu 100vlad.lu
Editors: kama 100
No comments
    Hello, !     Log In . Register