Skip to main content

User Role from Abonent to "nothing"

Hey there i just realized that every abonent has access to the dashboard of wordpress. i dont like that so i wanna have all users in wordpress as "no role" users. how can i automate that? or do i not need a wordpress user and i have just to deactive this thing (see attached image, its in german from fluentCRM) do i have to deactive the third hook? If i do so, is there any problem that i already hve 70 users within wordpress? i would just let them stay there and change all roles to "no role".

User Role from Abonent to "nothing"

Artur Abakarov

You can try the WPS Hide Login plugin or customize it through the code in functions.php (without the plugin), the main thing in the second case do it only if you understand and make backups.

add_action('admin_init', 'block_wp_admin_for_non_admins');
function block_wp_admin_for_non_admins() {
    if (is_admin() && !current_user_can('administrator') {
        wp_redirect(home_url());
        exit;
    }
}

Don't forget to clear your cache to test it.