The is_login_page()
function is taken from here
function is_login_page() {
if ( $GLOBALS['pagenow'] === 'wp-login.php' && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] === 'register' )
return true;
return false;
}
function my_redirect() {
//if you have the page id of landing. I would tell you to use if( is_page('page id here') instead
//Don't redirect if user is logged in or user is trying to sign up or sign in
if( !is_login_page() && !is_admin() && !is_user_logged_in()){
//$page_id is the page id of landing page
if( !is_page($page_id) ){
wp_redirect( get_permalink($page_id) );
exit;
}
}
}
add_action( 'template_redirect', 'my_redirect' );