How to Change the Default WordPress Role Names to Anything

How to Change the Default WordPress Role Names to Anything

WordPress offers five default roles – Admin, Editor, Author, Contributor and Subscriber – which control what users can and cannot do on a website, such as writing and approving content, plugin and theme management and administrative tasks.

Unfortunately, WordPress doesn’t allow you to change the names of the user roles. Luckily, there’s an easy fix for this.

In today’s Weekend WordPress Project I’ll show you how you can change the default role names to anything you want.

Customising Role Names

If you develop WordPress sites for clients, it can be hard trying to explain the different WordPress user roles.

For instance, if you’re working on an eCommerce site for a client and you’ve assigned them a role as a Contributor, the client may be puzzled – or even offended – that they have forked out big bucks for a website they only contribute to. Well, that’s their perception, anyway.

To change Admin, Editor, Author, Contributor and/or Subscriber, just had the following snippet to your theme’s functions.php file:

{code type=php}

function wps_change_role_name() {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$wp_roles->roles[‘contributor’][‘name’] = ‘Owner’;
$wp_roles->role_names[‘contributor’] = ‘Owner’;
}
add_action(‘init’, ‘wps_change_role_name’);

{/code}

This snippet (thanks to Kevin Chard!) will let you change any of the existing role names. For example, instead of Contributor you could have “Owner” (as in the snippet example above).

The snippet will also display within the role select menu for users.

Contributor to owner
Update your user roles to anything you want.

It’s also worth noting that this snippet doesn’t add a new role or permanently change the name. It also doesn’t update the role’s slug, so if you change Contributor to Owner, the slug will remain Contributor.