Every role has id (slug) and name (label) in URE terms. URE works with roles stuff via their id and uses their names just for visualisation.
I tried to rename ‘Editor’ role to ‘Administrator’ inside URE and did not see any change of the capabilities list granted to it.
Share the step by step scenario to repeat this.
Ah, I did not relabel the role through URE, I relabelled it via the code snippet below:
/**
* Relabel Roles
*
* @return void
*/
function prefix_relabel_roles() {
global $wp_roles;
if( empty( $wp_roles ) ) {
$wp_roles = new WP_Roles();
}
if( isset( $wp_roles->roles['editor'] ) ) {
$wp_roles->roles['editor']['name'] = esc_html__( 'Administrator' );
$wp_roles->role_names['editor'] = esc_html__( 'Administrator' );
}
if( isset( $wp_roles->roles['administrator'] ) ) {
$wp_roles->roles['administrator']['name'] = esc_html__( 'Super Admin' );
$wp_roles->role_names['administrator'] = esc_html__( 'Super Admin' );
}
}
add_action( 'init', 'prefix_relabel_roles' );
After using the above hook, if I go to the User Role Editor and click “Administrator (editor)” from the drop down, they suddenly have all the Administrator capabilities selected.
Thanks for the clarification. I still can not reproduce the described effect.
I installed code above as MU plugin. See renamed ‘Administrator (editor)’, ‘Superadmin (administrator)’ roles at User Role Editor, but original editor role has the same list of capabilities as before renaming, as it should be.
I tested renamed role update: adding and removing capabilities.
Re-check, if any JavaScript error appears at URE page? It may prevent view update. You may don’t see real role content in this case.
I can copy and paste the above code into a fresh install either as a MU plugin or straight into the themes functions.php file and I get the same result.
I can rename the editor and it appears -> https://snag.gy/f0s8zR.jpg
https://snag.gy/hmBGZH.jpg
When I comment out the rename, it reverts back to normal -> https://snag.gy/yK67xB.jpg
No JavaScript errors. Windows 10, Google Chrome, all up to date.