Check if user is logged in else login page
if(!current_user_can(‘administrator’)) { wp_redirect( wp_login_url() ); } This will redirect non-admins to login URL. Of course, logged in non-admins will be a bit confused. You’ll want to run this before get_header()