Languages: English • Italiano • 日本語 (Add your language)
Removes a role from WordPress.
NB: This setting is saved to the database (in table wp_options, field wp_user_roles), so it might be better to run this on theme/plugin activation
<?php remove_role( $role ); ?>
<?php remove_role( 'subscriber' ); ?>
to avoid calling remove_role when it's not needed you can check if the role exist
//check if role exist before removing it if( get_role('subscriber') ){ remove_role( 'subscriber' ); }
When a role is removed, the users who have this role lose all rights on the site.
remove_role()
is located in wp-includes/capabilities.php
.