WooCommerce: Disable Update Notifications @ WordPress Dashboard

We talked a lot about safely updating WooCommerce. The same applies to WordPress core, other plugins, themes… WordPress is such a delicate piece of software that you should ALWAYS know what to do before actually doing it ๐Ÿ™‚

Sometimes, website managers feel great about clicking on that “Update Now” link in their WordPress dashboard. It seems – and it is – so easy. Problem is, they’ll likely break the website.

The best way of doing this properly is to run the updates (as well as custom code, plugin tests, design changes) on a “staging environment“, which should be provided by your hosting company.

Either way, those “Update Now” links are too dangerous. Only you (the developer) need to know that – while it’d be better if the other users who have access to the dashboard didn’t see anything and concentrated on WooCommerce orders or WordPress post and content editing.

Clearly, there is a way to disable the update notifications on a per-user basis or, even easier, to only have 1 user (possibly you) see these. The snippet is a little complex, but there is a lot of literature online – this is the one that worked for me!

Hide and disable plugin/theme update notifications for certain users @ WordPress Dashboard

Snippet (PHP): Hide Plugin/Theme Update Notifications For All Users But 1 @ WordPress Admin Dashboard


/**
 * @snippet       Disable Update Notifications @ WordPress Dashboard
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=103268
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.3
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */ 

add_action( 'admin_init', 'bbloomer_hide_update_notifications_users' );

function bbloomer_hide_update_notifications_users() {
    global $menu, $submenu;
    $user = wp_get_current_user();
	
    // ENTER HERE THE ONLY ALLOWED USERNAME
    $allowed = array( 'rodolfomelogli' );
	
    // HIDE WP, PLUGIN, THEME NOTIFICATIONS FOR ALL OTHER USERS
    if ( $user && isset( $user->user_login ) && ! in_array( $user->user_login, $allowed ) ) {
        add_filter( 'pre_site_transient_update_core', 'bbloomer_disable_update_notifications' );
        add_filter( 'pre_site_transient_update_plugins', 'bbloomer_disable_update_notifications' ); 
        add_filter( 'pre_site_transient_update_themes', 'bbloomer_disable_update_notifications' );
    	
        // ALSO REMOVE THE RED UPDATE COUNTERS @ SIDEBAR MENU ITEMS
        $menu[65][0] = 'Plugins up to date';   
        $submenu['index.php'][10][0] = 'Updates disabled';   
    }
}

function bbloomer_disable_update_notifications() {
    global $wp_version;
    return (object) array( 'last_checked' => time(), 'version_checked' => $wp_version, );
}

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

7 thoughts on “WooCommerce: Disable Update Notifications @ WordPress Dashboard

  1. seriously? what are you doing? it’s messed up again.

    1. Ah thanks Jennifer, you’re right, HTML got decoded for some reason. Snippet fixed ๐Ÿ™‚

  2. He’s referring to this:
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘bbloomer_disable_update_notifications’ not found or invalid function name

    1. Gotcha! Fixed & thank you ๐Ÿ™‚

  3. you have a wrong callback.

    1. Thank you Tommy! Could you be more specific please so I can revise the snippet? Cheers

    2. Ah thanks Tommy, I figured it out thanks to James as well. Snippet has now been revised. Cheers ๐Ÿ™‚

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.