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        Get CustomizeWoo.com FREE
 * @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 custom code?

You should place PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my guide "Should I Add Custom Code Via WP Editor, FTP or Code Snippets?" and my video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything went 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.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent 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.

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

  1. Hi Rodolfo,

    It might be useful to leave a way to see the updates, when a certain url parameter is set.
    For example, calling /wp-admin/update-core.php?showupdates

    isset( $_GET['showupdates'] ) 
    

    Cheers!

    1. Nice, grazie!

  2. Hi Rodolfo! You seem to have an answer for everything, I love that!

    This works so well for me except a couple of little things โ€“ on page /wp-admin/update-core.php I have a bunch of notices like this:

    Notice: Trying to get property 'locale' of non-object in /container/application/public/site/wp-admin/update-core.php on line 40
    Notice: Trying to get property 'locale' of non-object in /container/application/public/site/wp-admin/update-core.php on line 42
    Notice: Trying to get property 'response' of non-object in /container/application/public/site/wp-admin/update-core.php on line 58

    Plus the Re-install Now and Hide this update buttons are still showing. Other than that it looks good โ€“ says WP, plugins, themes and translations are all up to date (a white lie but I know this is standard =).

    And also (possibly more important because it shows throughout admin), the red circle next to the plugins item in the menu sidebar is still showing (but when I click into that menu, all of the update warnings are gone which is awesome =)

    Would be so great if you could help with these, thanks for all you do!

    I’m using WPv5.1.1 + WCv3.6.3

    Cheers!

    1. Hello Billy, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  3. 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 ๐Ÿ™‚

  4. 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 ๐Ÿ™‚

  5. you have a wrong callback.

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

      1. 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 shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

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