Created
June 30, 2020 18:46
-
-
Save robertuniqid/71b919c493ab9e9aa2eaa5c43e067b64 to your computer and use it in GitHub Desktop.
eLearnCommerce - Simple Lock WP under 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
<?php | |
add_action( 'init', function() { | |
if( is_admin() ) | |
return; | |
if( is_user_logged_in() ) | |
return; | |
$trimmed_url = trim( get_site_url(), '/' ); | |
if( strpos( wpep_get_current_url(), $trimmed_url . '/wp-login.php' ) === 0 ) | |
return; | |
wpep_redirect( $trimmed_url . '/wp-admin' ); | |
exit; | |
}, 9999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment