WordPress at Your Fingertips

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.

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 5.8

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

From tag: Roles capabilities

vladlu 100vlad.lu
Editors: Kama 100
No comments
    Log In