I'm looking to add a line of code to apply css to certain roles.
For example:
If role "editor":
#wp-admin-bar-top-secondary{
display:none;
}
My snippet code:
add_action('admin_head', 'my_custom_style');
function my_custom_style(){
echo '<style>
/*remove media button*/
.wp-media-buttons {
display: none;
}
/*remove visual&code tabs*/
.wp-editor-tabs {
display: none;
}
</style>';
}
You could use the
rolesproperty of the user object returned fromwp_get_current_userDocs function.Note:
in_arrayfunction!!in_array())