没有钩子可以删除它。它必须用 CSS 和/或 jQuery 来解决。
在这里,CSS 和 jQuery 的作用几乎相同,您可以选择其中一种,也可以同时使用。
必须根据current_user_can
您的角色/能力设置进行调整。
请注意,钩子admin_head
可以有后缀,因此它只会在该特定/wp-admin/WP-PAGE.php
地址中运行。
add_action( 'admin_head-user-edit.php', 'so_13598192_remove_roles_dropbox' );
function so_13598192_remove_roles_dropbox()
{
// Admins can edit that, exit without printing scripts
if ( current_user_can( 'administrator' ) )
return;
?>
<style>
label[for=role], #role
{
display:none;
}
</style>
<script>
jQuery(document).ready(function($)
{
$('label[for=role]').parent().parent().remove();
});
</script>
<?php
}