WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/remove role

Contents

Description

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

Usage

 <?php remove_role$role ); ?> 

Parameters

$role
(string) (required) Role name
Default: None

Example

<?php remove_role( 'subscriber' ); ?>

Notes

When a role is removed, the users who have this role lose all rights on the site.

Changelog

Source Code

remove_role() is located in wp-includes/capabilities.php.

Related

Roles and Capabilities:
See also index of Function Reference and index of Template Tags.