How do I hide from a Shop Manager’s view, the nags warnings from Woocommerce notifying me that X Pro not being compatible? I have created a username for my client and I don’ want him to see ANY warning notifications and I hid all of the menu items I don’t want him to have access to. I added the code below to my “functions.php” file and it hid most of them but I still have 2 that I want out. The “Essential Grid” notification and the “Woocommerce” one. (See attached image)
add_action('admin_head','admin_css'); //using action hook to modify css
function admin_css()
{
if(current_user_can('shop_manager')) //check the current user role
{
echo '<style>';
echo '.notice{display:none}';
echo '</style>';
}
}
~~~~~~~~~END CODE~~~~~~
<img src="//tco-forum-uploads.s3.amazonaws.com/original/2X/2/2997eeaa2c56a265772d901a07316933c31cb229.png" width="690" height="169">
I also used this code to hide from everyone except admin. I would prefer to have it this way so I know that none of these notifications are shown to anyone else.
CODE BELOW:
Hide from everyone but:
add_action('admin_head','admin_css'); //using action hook to modify css
function admin_css()
{
if(!current_user_can('admin')) //check the current user role which is not admin
{
echo '<style>';
echo '.notice{display:none}';
echo '</style>';
}
}
Thank you!