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;" ) );
}

27 Responses to “Disabling the update nag”

  1. Now this is very handy. Thanks.

  2. Indeed very useful. Thanks for sharing this :)

  3. This is possibly a very bad idea. The nag is there for a reason, the correct thing to do is take the 5-10 minutes to simply update your version of wordpress. Don't be LAZY! Do it an be done with it.

  4. @Joost I run a blog with multi-authors, but it's only 2 blogs. I don't run 25+ blogs though. So my statement applies to people with less than 25 blogs. :)

  5. What about making it show to a certain user id/name?

    • i tried your code to show update prompts to admin only, but it seems it was hiding from admin only. I changed =="admin" to !=="admin" and it worked for me. I also removed the reference to $user_email because I couldn't see what it was there for.

      Here is the updated code that worked for me:


      global $user_login;
      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;" ) );
      }

      p.s.
      i'm just a hack, i could never have written this from scratch and your code (with tweaks) works like a dream. thanks for the awesomeness!

  6. Wow that was fast - thanks!

  7. Liking the userid/name.

    I had no idea that showed to multiple users!

  8. Thanks a lot. That was driving me crazy. I am content to wait until Godaddy updates and pushes the automated Wordpress patches. I just don't have time to mess with installing WP so frequently on multiple blogs. Keep up the good work.

  9. That is a nice way of handling this !

    This nag has been bothering me for quite a while but just cutting it out of the code was too crude.

  10. I have just started to use WordPress2.6.5 and this is really cool.

  11. What about a plugin that instead of disabling the nag entirely gives you the option to 'remind me later' - and then re-nags 1 day, week or other amount later... Then it can also tell you how long you have procrastinated.

    I try to update when I can - but with a regular job, I can't always get to it right away. Sometime I need to wait for the weekend.

  12. Its about time there was a plugin for that. I use WordPress for a multi-author blog and there is one user who will email me every time she sees that message come up!

  13. Whilst we're on the subject of 2.6.5 .. is it stable, time to wait or time to upgrade? I thought 2.7 was due out in Nov anyway?

  14. Thanks for the post. Interesting to say the least, I have to wait until cPanel updates it's version, then update there. This would be nice so that only I know what the latest version number is.

  15. Oh thats why I'm got notice for the update. Thanks for this tips.

  16. Thank god we don't have to fight with these kinda things after 2.7 (auto upgrade system )

  17. Hey Joost,

    That's a really good way, here's another one I used to make mine disappear a few months ago: http://www.rajaietalks.com/how-to-get-rid-of-the-annoying-wordpress-update-nag

    Basically I made it go away by editing the CSS file.

    Rajaie

  18. Perhaps those with multiple blogs should consider using single installation such as virtual multiblog, wp mu, wp-hive plugin etc. There's no more excuse as there's only one set of codes to update. Not doing updates is simply too risky in some cases.

  19. Thank you so much, I was not even aware anyone else could see that nag, which I hate but I guess it's useful.

  20. Thank god we don't have to fight with these kinda things after 2.7

  21. Great code sample. I often just use the plugin, but I prefer this method.
    @Rajaie, great CSS hack. I didn't think of that either. :-)

  22. I did not know that. Just began to pickup Wordpress again for several projects. The auto updater/ multiblog sounded good to me. A lot happened since my last WP install. :) Thanks for the fine news.

  23. Hey, thanks a lot.

    Our WP-powered site runs a webshop (the awesome "wp-ecommerce" plugin) but that one is NOT compatible with WP 2.8.0 so therefor it was annoying that all Editors and Writers saw "There's an update to Wordpress, please contact the siteadministrator" - and I had to explain what's going on.

    Leaving it on for me is fine.

    --
    Thanks again,
    TEMC

1 Tweetbacks to “Disabling the update nag”

  1. Twitter avatar for

    How to Disabling Wordpress the update nag via.http://yoast.com/disable-update-nag/

icon

Want an avatar too?

Go to gravatar.com and upload your preferred avatar.

You can use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">