Created
August 11, 2019 03:54
-
-
Save oliverll1/b0c01f2ce12f0a51cfa264d6b2a99ee2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('template_redirect','my_non_logged_redirect'); | |
function my_non_logged_redirect() | |
{ | |
if(is_page('login') || is_page('my-account')){ | |
return; | |
} | |
if ( !is_user_logged_in() ){ | |
ob_clean(); | |
$url = get_home_url() . '/login'; | |
wp_redirect($url); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment