Created
September 15, 2022 21:21
-
-
Save Artisan-Asad/ddadafdfe45c7938748226c7b8864bfe to your computer and use it in GitHub Desktop.
WordPress Force Login
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
/** | |
* Force login. | |
*/ | |
add_action('template_redirect', function () { | |
if (!is_user_logged_in() && !is_404()) { | |
auth_redirect(); | |
exit; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment