Disabling the update nag

WordPress' core update nag is quite the useful thing, I'll usually know before it shows that there's an update, but a lot of people won't. If you don't know what I mean with core update nag, it's this thing:

core update nag

The issue is that this thing doesn't only show to you, it shows to all users of your blog. Now there's a plugin that will disable this for you, but it will disable it for everyone, yourself included.

A better thing to do, in my humble opinion, is either edit that plugin to have the following code, or add this code to your themes functions.php:

if ( !current_user_can( 'edit_users' ) ) {
  add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
  add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}

This will show the nag to you, but prevent "normal" users from seeing it.

Update, as asked by Kevin in the comments, here's how to show them to a certain username, in this case "admin":

global $user_login , $user_email;
get_currentuserinfo();
if ($user_login == "admin") {
  add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
  add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}

Related posts

  1. Update of Robots Meta plugin: more duplicate content issues solved
  2. Update to users to CSV plugin
  3. More WordPress SEO: robots-meta update
  4. Sociable & SlideShare update
  5. Update to Robots Meta plugin

Want more WordPress tips?

You should subscribe to my WordPress Newsletter, as you'll get a whole lot more WordPress tips and tricks there! Also, subscribe to this blog right now with RSS, or daily or weekly emails!

25 Responses to “Disabling the update nag”

Directory Journal
SEO Book Tools
Thesis
SearchEngineWatch
WooThemes
Pepperjam
Hosting by:
Hosted by MediaTemple Grid Services