Restrict wp-admin access to a few roles
10 Mai 2013, Posted by inYou may want to deny access to wp-admin to subscribers, since they haven’t too much to do inside wp-admin, right? It is quite easy to deny access to them, just use this snippet:
<?php function restrict_access_admin_panel(){ global $current_user; get_currentuserinfo(); if ($current_user->user_level < 4) { //if not admin, die with message wp_redirect( get_bloginfo('url') ); exit; } } add_action('admin_init', 'restrict_access_admin_panel', 1); ?>