Created
October 23, 2012 16:22
-
-
Save deegs/3939847 to your computer and use it in GitHub Desktop.
Don't let non-admin users access 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
/*-----------------------------------------------------------------------------------*/ | |
/* Don't let non-admin users access wp-admin. | |
/*-----------------------------------------------------------------------------------*/ | |
add_action( 'init', 'blockusers_init' ); | |
function blockusers_init() { | |
if ( is_admin() && ! current_user_can( 'administrator' ) ) { | |
wp_redirect( home_url() ); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment