Do not allow subscribers to access the backend

April 29th, 2010 |

To deny access to users with role “subscriber” to the backend you can write next lines in the “functions.php”

if (is_admin()) {
    global $current_user;
    get_currentuserinfo();
    $user_roles = $current_user->roles;
    $user_role = array_shift($user_roles);
    if ($user_role == 'subscriber') {
        wp_redirect(site_url());
        exit;
    }
}

There are no comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *

*