Remove update nags for non-admins [duplicate]

In wp-admin/includes/update.php file

if ( current_user_can('update_core') )
        $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="https://wordpress.stackexchange.com/questions/231010/%s">please attempt the update again now</a>.'), 'update-core.php' );
    else
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');

We can see that messages are different based on the current user role and this is maintenance_nag.

Basically we have two update nags and can be found in admin-filters.php

add_action( 'admin_notices', 'update_nag',      3  );
add_action( 'admin_notices', 'maintenance_nag', 10 );

So to remove second message we can use(also check for current user role if you want this only for non-admins)

remove_action( 'admin_notices', 'maintenance_nag', 10 );

For multi-site use

remove_action( 'network_admin_notices', 'maintenance_nag', 10 );

Leave a Comment