WordPress Snippets at WPcustoms

Hide update notice to all but admins

Are your authors and contributors annoyed by the update notice when a new WP version is released? It does not make much sense to show it because they cannot update the core. Why not hide it and show that update info only for admins? Here you go.


/**
 * Snippet Name: Hide update notice to all but admins
 * Snippet URL: https://wpcustoms.net/snippets/hide-update-notice-admins/
 */
  function hide_update_notice_to_all_but_admin_users() 
{
    if (!current_user_can('update_core')) {
        remove_action( 'admin_notices', 'update_nag', 3 );
    }
}
add_action( 'admin_notices', 'hide_update_notice_to_all_but_admin_users',