How do I remove the “X” from the admin bar? I have other roles accessing the back end, and I don’t want them to have access to any theme-based activities. Is there a way to remove it or turn that drop down menu off.

How do I remove the “X” from the admin bar? I have other roles accessing the back end, and I don’t want them to have access to any theme-based activities. Is there a way to remove it or turn that drop down menu off.

Hi There,
Please try adding this custom code under functions.php file:
add_action( 'wp_head', 'print_custom_css' );
add_action( 'admin_head', 'print_custom_css' );
function print_custom_css(){
if(!current_user_can( 'administrator' )){
?>
<style type="text/css">li#wp-admin-bar-tco-main {display: none !important;}</style>
<?php
}
}
This code will remove the X dropdown menu for non-administrator users.
Regards!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.