admin管理员组

文章数量:1331650

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 '<style>label[for=wpassetcleanup_asset_list-hide] { display: none; }</style>';
}

any help really appreciate

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 '<style>label[for=wpassetcleanup_asset_list-hide] { display: none; }</style>';
}

any help really appreciate

Share Improve this question asked Jul 12, 2020 at 3:41 jasawebjasaweb 519 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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
}

本文标签: functionsRemove check boxes and its label from screen option for custom role