Renaming User roles in wordPress

Renaming existing WP User Roles

If you are the only person who is running your website, you have probably never had to think about WordPress user roles. However, if you ever need to give access to other people to access your WordPress web site, WordPress user roles are essential for controlling what actions the various users at your site are permitted to take.

By smartly applying the WordPress user roles, you ensure that no one has more power than they need. And this helps make your site more secure and streamline your workflow. In the below code will see how to rename the existing wordpress user roles.

In this article, we are going to show how to rename existing user roles in a simple step. By registering a function in functions.php file in the active theme directory.

Paste the below code functions.php to Renaming User roles in WordPress

function wps_change_role_name() {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$wp_roles->roles['subscriber']['name'] ='Member';
$wp_roles->role_names['subscriber'] = 'Member';
$wp_roles->roles['lp_teacher']['name'] ='Trainer';
$wp_roles->role_names['lp_teacher'] = 'Trainer';
add_action('init', 'wps_change_role_name');


check for related WordPress products on amazon (affilate link)

About the author



Vishwas Hegde is the architect of ProCodersOnline.com. I'm a Software Engineer and technology enthusiast person who loves to learn and explore new things and technologies. When i'm not writing content for my websites, I love to travel and explore the nature.

Add Comment

Click here to post a comment