Restricting wp-admin using Tadlock’s Members plugin

1. Install Justin Tadlock’s Members plugin

2. After activation go to User > Roles and edit the Administrator role and add a new capability called ‘access_admin’ for example

3. Add the following code to your theme’s functions.php:

function restrict_admin(){
	//if not administrator, kill WordPress execution and provide a message
	if ( ! current_user_can( 'access_admin' ) ) {
		wp_die( __('You are not allowed to access this part of the site') );
	}
}
add_action( 'admin_init', 'restrict_admin', 1 );

And you’re done! Only users with the ‘Administrator’ role or the ‘access_admin’ capability will be able to access wp-admin.