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 badges1 Answer
Reset to default 0You 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
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742270273a4412568.html
评论列表(0条)