Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1379
    [email protected]
    Participant

    Greetings,

    I found a previous post that you disabled this option to delete the default roles but were going to enable this feature in the settings so it can be done. I need this feature too. I make ecom sites that only need admin, shop manager and customer roles. Everything else is not needed.

    Please let me know if this can be done with your plugin.

    #1389
    Vladimir
    Keymaster

    Hi,

    It is one time operation. So create wp-content/mu-plugins folder, create there remove_built_in_roles.php file ant copy/paste code below to that file:

    
    <?php
    add_action('admin_menu', 'remove_built_in_roles');
    
    function remove_built_in_roles() {
        global $wp_roles;
    
        $roles_to_remove = array('subscriber', 'contributor', 'author', 'editor');
    
        foreach ($roles_to_remove as $role) {
            if (isset($wp_roles->roles[$role])) {
                $wp_roles->remove_role($role);
            }
        }
    }
    
    

    It will remove all built-in roles except ‘administrator’ from your WordPress.

    After you will see that roles were removed you may delete this file from mu-plugins folder.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.