I want to hide the front-end from every visitor/logged out user. To see the front-end, every user must have been registered and logged in.
Any visitor that's logged out should be redirected to the default WordPress login page.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
One way of doing this would be to add the code below to the top of your template file(s):
<?php // redirect to login page if user is not logged in if ( !is_user_logged_in() ) : header('Location: /wp-login.php'); exit(); endif; ?>
There are some subtleties around redirecting in PHP that you may want to consider, but for me the above code works.