functions - 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_leade

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
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742270273a4412568.html

相关推荐

  • functions - 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_leade

    2天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信