Update Informations Only for Admins

If you only want to let users, who are privileged to receive information about updates and plugins, you should copy the following code to your functions.php of your theme. These users have to have the right “edit plugin” (edit_plugins) to receive updates.

Alternative: use the plugin Secure WordPress, the plugin has inside the function to active this possibility.

/**
 * remove core-Update-Information
 * @rights: http://codex.wordpress.org/Roles_and_Capabilities
 */
if ( !current_user_can( 'edit_plugins' ) ) {
	// core update
	add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ) );
	add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
	// plugin update
	add_action( 'admin_menu', create_function( '$a', "remove_action( 'load-plugins.php', 'wp_update_plugins' );" ) );
	add_action( 'admin_init', create_function( '$a', "remove_action( 'admin_init', 'wp_update_plugins' );" ), 2 );
	add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_update_plugins' );" ), 2 );
	add_filter( 'pre_option_update_plugins', create_function( '$a', "return null;" ) );
}

Posted

in

by