Created
December 10, 2020 05:40
-
-
Save wpjess/18c25942e9cac9f79839fb8568691df4 to your computer and use it in GitHub Desktop.
Hide a WordPress site unless logged in
This file contains 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
function hide_from_everyone() { | |
if( !is_admin() && !is_user_logged_in() ){ | |
die(); | |
} | |
} | |
add_action( 'template_redirect', 'hide_from_everyone' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment