Skip to content

Instantly share code, notes, and snippets.

@NickMkrtchyan
Created May 20, 2022 14:46
Show Gist options
  • Save NickMkrtchyan/bfbb9254a07cc56e211d3132018b5f54 to your computer and use it in GitHub Desktop.
Save NickMkrtchyan/bfbb9254a07cc56e211d3132018b5f54 to your computer and use it in GitHub Desktop.
Snippet for rename default WordPress / WooCommerce role name
/**
* @snippet WooCommerce Rename Customer Role Name
* @how-to https://woohacks.github.io/
* @author Nick Mkrtchyan
* @compatible WooCommerce 5.0
*/
function change_role_name() {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$wp_roles->roles['customer']['name'] = 'Student';
$wp_roles->role_names['customer'] = 'Student';
}
add_action('init', 'change_role_name');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment