Administrator role gone

When i create custom user role like Super-admin current Administrator privilege is gone as well as Administrator Role from drop-down is gone in new user creation section. Which throws error even while installing plugins which need Administrator privilege plugin does work at all.

Show us the code you are using to add the new custom role. I don’t think you can actually get rid of the role, but you can prevent it from being displayed in a drop down. Show us your hook/filter for adding the new role.

add_role( 'mainadmin', 'Main-Admin', get_role( 'administrator' )->capabilities );
so if user role is not equal to mainadmin then denied access to menu,pages and so on:

add_action('admin_menu', function () {
	if(!current_user_can('mainadmin')) {
             remove_menu_page('plugins.php');
	         remove_menu_page('themes.php');
               so on......
         }
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.