Iuse this code for restrict access to wordpress admin. But now i must allow access to author too. Only for this roles. Is possible with this code? Really thanks
add_action( 'init', 'blockusers_init' );
function blockusers_init() {
if ( is_admin() && !current_user_can( 'author' ) && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
wp_redirect( home_url() );exit;
}
}