I am trying to remove/hide all update nags & plugin errors in Wordpress dashboard for a specific user role dc_vendor.
I've tried with echo some CSS display: none; and remove_action 'admin_notices in my function but neither seems to work.
function remove_nags_vendor() {
$user = wp_get_current_user();
if ( in_array( 'dc_vendor', (array) $user->roles ) ) {
remove_action( 'admin_notices', 'update_nag', 3 );
remove_filter( 'update_footer', 'core_update_footer' );
}
}
add_action('admin_head', 'remove_nags_vendor');
I expect that all update nags and plugin error messages are removed or hidden for the user role dc_vendor in the Wordpress admin dashboard