How to modify the name of the WordPress default role

WordPress provides five default roles, different roles have different permissions, decide what they can and can not do; for example: whether the right to write or review other people’s articles; whether the right to replace the site theme. However, WordPress does not allow you to directly modify the default role name. However, it is not difficult to do it, the theme cat today will tell you how to modify these default roles.
WordPress default 5 roles are: Admin, Editor, Author, Contributor, Contributor, Subscriber.

Why do I need to customize the role name?
For users who use WordPress to build a personal blog, there is no need to modify these role names, because he generally does not use these. But for the corporate website is necessary.
WordPress after the acquisition of WooCommerce, the use of WordPress to build foreign trade sites and online mall users will be further increased. If you use WordPress to help customers to do an e-commerce site, site visitors (that is, potential customers) will be very strange, why their identity is Subscriber (subscribers)? Therefore, this time must deal with this problem.
To modify the default role of WordPress, you only need to write down the code to copy the functions.php file or the site-specific plugin for the theme you are using:

  1. function wps_change_role_name() {
  2.   global $wp_roles;
  3.   if ( ! isset( $wp_roles ) )
  4.    $wp_roles = new WP_Roles();
  5.   $wp_roles->roles[‘contributor’][‘name’] = ‘Owner’;
  6.   $wp_roles->role_names[‘contributor’] = ‘Owner’;
  7. }
  8. add_action(‘init’, ‘wps_change_role_name’);

The name of the Contributor role is changed to Owner (owner, owner). Here you can also use the Chinese, but must remember to save the file as utf8 no bom format, otherwise the Chinese may be displayed as garbled.
This code comes from Kevin Chard’s website. And then look back at the role of the site, turned into this:

However, it should be noted that this code is only the name of the Contributor role modified, and will not modify the corresponding permissions, nor add a new role, and even the role of slug (abbreviation, alias) will not modify.