When an update is available for WordPress, it shows a notice at the top of the screen in the administrative backend. It does this for all users, including those who don’t have access to install the updates. If you want to hide the update message from users who cannot install updates, such as editors, authors and contributors, you can easily do that. The following code will hide the update message from users who do not have the manage_options
capability, which on a default WordPress installation would be everyone except Administrators or Super Admins. Visit the codex for more information about WordPress roles and capabilities.
/* Only show WordPress update nag to admins */ function jp_proper_update_nag() { if ( !current_user_can( 'manage_options' ) ) { remove_action( 'admin_notices', 'update_nag', 3 ); } } add_action( 'admin_notices', 'jp_proper_update_nag', 1 );
Hi!
I have to hide notices for woocommerce customers, how can I? I used your snippet, but it doesn’t work.
Hi, the code should work because WooCommerce customers shouldn’t have the ‘manage_options’ capability. Are you running WordPress multisite? If so, you may need to use ‘network_admin_notices’ also. So something like this:
remove_action( 'network_admin_notices', 'update_nag', 3 );
Hi!
As soon as I add your snippet, woocommerce checkout form split up and customers weren’t able to do any purchase. I must get rid of it from functions.php :(
I’m still searching for a snippet which let me hide notices for woocommerce customers. Any hint? Bye!
I can’t imagine why removing an admin notice would touch the checkout page or prevent customers from buying. They’re not related at all. Do you have a screenshot of what that looks like?