Remove check boxes and its label from screen option for custom role

I want to hide many check boxes and its label in screen option only for custom user role (wdm_instructor and group_leader). How to apply below code so its for custom user role only:

add_action( 'admin_head', 'remove_wordpress_cfields' );

function remove_wordpress_cfields() { 
    echo 'stylelabel[for=wpassetcleanup_asset_list-hide] { display: none; }/style';
}

any help really appreciate

Topic screen-options user-roles functions Wordpress

Category Web


You can check the current user role in the same action and apply "display none" for that specific user role

$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
  //The user has the "author" role
}

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.