Restrict WordPress Dashboard Access

This only 5 lines snippet prevent any logged user but admins to visit the wordpress dashboard.
You can log-in on the wp-login.php page.

No admin access

Just copy/paste it in your functions.php in your theme folder.

function baw_no_admin_access()
{
 if( !current_user_can( 'administrator' ) ) {
     wp_redirect( home_url() );
     die();
  }
}
add_action( 'admin_init', 'baw_no_admin_access', 1 );