Created
June 18, 2020 11:27
-
-
Save cryptexvinci/985104b8f7af8e3b4c865eba734ffe97 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
<?php | |
add_action( 'init', 'hide_secure_wp_admin' ); | |
function hide_secure_wp_admin() { | |
if ( is_admin() || $GLOBALS['pagenow'] === 'wp-login.php' ) { | |
// Non logged in users. | |
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) { | |
wp_redirect( um_get_core_page('login') ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment