Created
July 10, 2014 13:49
-
-
Save skydriver/f8691c20569b79a6bb2d to your computer and use it in GitHub Desktop.
Restrict direct access to wp-login and wp-admin
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 codeart_block_dashboard_from_non_super_admins() | |
{ | |
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; | |
if( !is_super_admin() ) | |
if( strpos($actual_link, 'wp-admin') !== false || strpos($actual_link, 'wp-login.php') !== false ) | |
if( strpos($actual_link, 'admin-ajax.php') === false && strpos($actual_link, 'wp-login.php?action=logout') === false ) | |
wp_redirect( get_bloginfo('home') . '/log-in/' ); | |
} | |
add_action('init', 'codeart_block_dashboard_from_non_super_admins'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment