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
 * @community     https://businessbloomer.com/club/
 */ 

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 custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Add Second Description @ Product Category Pages
    In terms of SEO, if you’re trying to rank your product category pages, you really need to make the most of the default WooCommerce product category “description” and “thumbnail”. Most themes, if compatible with WooCommerce, will show this content right below the product category name and above products. Nothing new so far. But what if […]
  • WooCommerce: Add Column to Orders Table @ WP Dashboard
    The WooCommerce Orders Table, which can be found under WP Dashboard > WooCommerce > Orders, provides us with 7 default columns: Order – Date – Status – Billing – Ship to – Total – Actions. This is used by shop managers to have an overview of all orders, before eventually clicking on a specific one. […]
  • WooCommerce: Hide/Show The WP Admin Bar
    In previous WooCommerce versions, new customers could access the WP Admin black bar after purchase. Now this seems fixed. Still, what about other user roles, and what if you want to override this default behavior? Well, here’s a quick snippet for you – feel free to use it in your own WooCommerce site. Enjoy!
  • WooCommerce: Display Custom Filters @ WP Dashboard > Products
    If you go to WordPress Dashboard > Products you will find default product admin filters such as “Select a category”, “Filter by product type”, “Filter by stock status”. What if you want to add more custom filters to let your shop managers find products easily? For example, you could add “Filter by product tag” (“product […]
  • WooCommerce: View Thank You Page @ Order Admin
    I’ve been testing for over an hour but finally I found a way to make this work. When you are in “Edit Order” view under WordPress Dashboard > WooCommerce > Orders, there is a dropdown of “Order actions”: “Email invoice”, “Resend new order notification”, etc. A major problem I’ve always had while troubleshooting or working […]

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. Follow @rmelogli

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? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. 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 the Business Bloomer Club to get quick WooCommerce support. Thank you!

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