Last active
September 1, 2019 15:00
-
-
Save macariojames/a79cb60fe91fd15d0f3efec93f43f645 to your computer and use it in GitHub Desktop.
WordPress redirect non-logged in user to a page/site
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
<?php | |
// put this in header.php | |
if (!is_user_logged_in()) { | |
wp_redirect( 'https://www.yourdomain.com'); | |
exit; | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment