Hide Author.php template from specific user role

The template_include hook allows you to change which template file is going to be used.

In it, you can conditionally check if it’s an author page requested, then use get_query_var() to get the requested author. You then check the authors role and see if it’s what you don’t want, and use a different template if so.

Below is untested, but something like:

add_filter( 'template_include', 'myplugin_author_redirect', 99 );

function myplugin_author_redirect( $template ) {

    if ( is_author() ) { // When any Author page is being displayed

        // get the user page being requested
        $user = get_user_by('slug', get_query_var('author_name'));
        $user_role = array_shift($user->roles);

        // user roles we want to redirect away
        $exempt = array('editor', 'contributor');
        if ( in_array($user_role,$exempt,true) ) {
            // wtv file you want to load when an editors or contributor author page is requested
            return locate_template( array( 'archive.php' ) );
        }
    }
    return $template;
}

error code: 523