Hello,
I am trying to combine 2 functions. The first one is for applying css or hiding specific elements by role
<?php
add_action( 'wp_head', 'get_user_role' );
function get_user_role() {
global $current_user;
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
if ($user_role == "customer"){
?>
<style type="text/css">
#wpadminbar{display:none!important;}
</style>
<?php
}elseif ($user_role == "subscriber") {
?>
<style type="text/css">
#mega-menu- {
display:none!important;
}
</style>
<?php
};
};
The second one is for applying css backend at wordpress dashboard
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
#adminmenu{display:none!important;}
.widefat tfoot td.check-column, .widefat thead{color:red!important;}
</style>';
}
How could I combine these 2 functions and hide specific elements in wordpress dashboard by role?