Created
January 19, 2013 12:35
-
-
Save michaeloeser/4572450 to your computer and use it in GitHub Desktop.
Restrict Admin Area To Only Admin Users
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
<?php | |
function restrict_admin() | |
{ | |
if ( ! current_user_can( 'manage_options' ) ) { | |
wp_redirect( site_url() ); | |
exit; | |
} | |
} | |
add_action( 'admin_init', 'restrict_admin', 1 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: http://www.paulund.co.uk/restrict-admin-area-to-admin-users