Skip to content

Instantly share code, notes, and snippets.

@kfriend
Created August 8, 2013 13:55
Show Gist options
  • Save kfriend/6184796 to your computer and use it in GitHub Desktop.
Save kfriend/6184796 to your computer and use it in GitHub Desktop.
Wordpress: Disable Admin Dashboard For Subscribers
add_action('admin_init', function() {
if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
wp_redirect(home_url()); exit;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment