admin管理员组文章数量:1331895
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
}
本文标签: functionsRemove check boxes and its label from screen option for custom role
版权声明:本文标题:functions - Remove check boxes and its label from screen option for custom role 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742270273a2444173.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论