WordPress has a function to check if user is logged in or not.
is_user_logged_in()
You can use this function with conditional statements to restrict not logged in users from accessing contents.
for example if you want to restrict the homepage for not logged in users you may do this with following code.
function annframe_restrict_access() {
if( is_home() || is_front_page() ) {
if( ! is_user_logged_in() ) {
wp_redirect( home_url( 'page-name' ) );
exit();
}
}
}
add_action( 'init', 'annframe_restrict_access' );