Skip to content

Instantly share code, notes, and snippets.

@RalfAlbert
Created December 11, 2011 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RalfAlbert/1459639 to your computer and use it in GitHub Desktop.
Save RalfAlbert/1459639 to your computer and use it in GitHub Desktop.
Removing update notifications for non-admins
/* put this function in your functions.php. You can use it very often */
function __return_null(){
return NULL;
}
/* stop informing non-admins */
global $current_user;
if( ! current_user_can( 'update_core' ) ){
# 2.8 to 3.0:
remove_action( 'wp_version_check', 'wp_version_check' );
remove_action( 'admin_init', '_maybe_update_core' );
add_filter( 'pre_transient_update_core', '__return_null' );
# 3.0:
add_filter( 'pre_site_transient_update_core', function(){ return NULL; } ); // with PHP 5.3, using anonymous functions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment