Skip to content

Instantly share code, notes, and snippets.

@hchouhan
Created September 12, 2013 14:46
Show Gist options
  • Save hchouhan/6538693 to your computer and use it in GitHub Desktop.
Save hchouhan/6538693 to your computer and use it in GitHub Desktop.
Restrict Admin Area To Only Admin Users
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