Skip to content

Instantly share code, notes, and snippets.

@habibmac
Created June 6, 2012 15:23
Show Gist options
  • Save habibmac/2882582 to your computer and use it in GitHub Desktop.
Save habibmac/2882582 to your computer and use it in GitHub Desktop.
WP: Remove update notification for all users except ADMIN user
// REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
// This code will ensures that no users other than "admin" are notified by wordpress when updates are available..
global $user_login;
get_currentuserinfo();
if ($user_login !== "admin") { // change admin to the username that gets the updates
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}
// Changed version to only show update notification for admin users (as opposed to just the user 'admin'):
// REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
global $user_login;
get_currentuserinfo();
if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment