Ever wanted to change the default WordPress user role names? This snippet will let you change any of the existing role names, such as “Administrator”, “Editor”, etc., to anything that you like. This will display within the role select menu for users. Please note this does not add a new role or permanently change the name.
Instructions
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
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');
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out How to Create a Custom User Registration Form in WordPress.
Hello,
How do we revert it? I created a site specific plugin for this, then I deleted it thinking that it was enough to revert back to the default user role label
Hey Cristiano,
If you’ve created the site-specific plugin manually, then you can go ahead and remove the code snippets you’ve inserted onto your plugin editor page.
Alternatively, if you’ve installed the Code Snippets plugin, you can deactivate the specific snippet you’ve added by navigating to Snippets » All Snippets from your WordPress dashboard.
Hello,
Thank you, I deactivated and then removed the plugin but the contributor role, didn’t reverted back. It remains as Owner. Weird, no?
can this be used in multisite wordpress on Version 4.8.2? because i put this code in function.php, its not working on add new user page
[…] snippet (thanks to Kevin Chard!) will let you change any of the existing role names. For example, instead of Contributor you could […]
[…] to Kevin Chard for the […]
Nice function, but good to keep in mind is that the slug of the Role remains the original…
Yes this is true you would need to also change the slug, however at that point it may be better to create a new role rather than change the name of the existing. I still think this has some uses.
Oh I agree, it definitely has some good uses! I just meant that it is something to keep in mind 🙂
Fair enough, and good point 🙂