We’ve all seen them, those pesky notices to update your WordPress installation. Worse still, we’ve all had customers say, “I see there’s an update available…”. Yes, we do want to keep our WordPress installations up to date, but we don’t want those without the necessary permissions to pester us about it on a daily basis.
WordPress released another update today and I was again reminded of this irritating notice system they operate as many of the sites I managed sprung into life with WordPress update notices and the odd message came through about it from clients.
Thankfully, a quick code snippet is all you need to rid yourself of this problem. If you would prefer the update notice only be shown to those with the permission to actually update, you can add the following code to your functions.php file and go back to your quiet life.
function restrict_update_notice() { // Check to see if user has the ability to update the core if (!current_user_can('update_core')) { // If not, remove the admin notices remove_action('admin_notices', 'update_nag', 3); remove_action('network_admin_notices', 'update_nag', 3); } } add_action('admin_head', 'restrict_update_notice', 1);
You can read more about the functions in this code snippet here:
- Function Reference – current_user_can
- Function Reference – remove_action
- Function Reference – add_action
Hopefully that will save a few headaches for you in the future.