Trying to restrict access to admin area based on role in wordpress 3.6
Tried the following. This prevents anyone without administrator access but not my custom role "Super User". This keeps redirecting to the homepage.
function prevent_admin_access()
{
if ( false !== strpos( strtolower( $_SERVER['REQUEST_URI'] ), '/wp-admin' ) && !current_user_can( 'administrator' ) && !current_user_can( 'Super User' ) )
wp_redirect( home_url() );
}
add_action( 'init', 'prevent_admin_access', 0 );