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:
![]()
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;" ) );
}




by Lyndi on 26 November, 2008 at 10:41
Now this is very handy. Thanks.
by smottt on 26 November, 2008 at 11:42
Indeed very useful. Thanks for sharing this :)
by Jay on 26 November, 2008 at 14:31
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.
by Joost de Valk on 26 November, 2008 at 14:42
@Jay: you're obviously not running 25+ blogs, or multi author blogs with more than 2 users. The email will kill you sometimes.
by Jay on 26 November, 2008 at 14:47
@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. :)
by Kevin on 26 November, 2008 at 14:47
What about making it show to a certain user id/name?
by Joost de Valk on 26 November, 2008 at 15:00
@Kevin: good question, updated the post!
by frederick on 19 June, 2009 at 18:24
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_emailbecause 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!
by Kevin on 26 November, 2008 at 15:03
Wow that was fast - thanks!
by Tertius on 26 November, 2008 at 17:54
Liking the userid/name.
I had no idea that showed to multiple users!
by Ian on 27 November, 2008 at 09:27
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.
by Martijn on 27 November, 2008 at 10:34
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.
by Antony on 27 November, 2008 at 14:04
I have just started to use WordPress2.6.5 and this is really cool.
by Tom on 27 November, 2008 at 17:37
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.
by Michael Henry on 28 November, 2008 at 04:11
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!
by gadget on 28 November, 2008 at 21:00
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?
by Nathan P. on 30 November, 2008 at 03:30
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.
by iskandarX on 30 November, 2008 at 08:07
Oh thats why I'm got notice for the update. Thanks for this tips.
by Shanker Bakshi on 1 December, 2008 at 17:52
Thank god we don't have to fight with these kinda things after 2.7 (auto upgrade system )
by Joost de Valk on 2 December, 2008 at 09:49
Thanks for all the comments!
@Shanker: so right.
by Rajaie AlKorani on 5 December, 2008 at 18:56
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
by Hilmy on 6 December, 2008 at 10:24
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.
by Shelly Thomas on 7 December, 2008 at 08:34
Thank you so much, I was not even aware anyone else could see that nag, which I hate but I guess it's useful.
by Golfkurs on 9 December, 2008 at 01:07
Thank god we don't have to fight with these kinda things after 2.7
by Shirley on 9 December, 2008 at 17:43
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. :-)
by Jabz on 12 December, 2008 at 20:28
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.
by TeMc on 30 June, 2009 at 14:55
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
by Mark on 14 July, 2009 at 17:27
Does this still work for 2.8 Joost?
Not sure if a plugin could interfere with it but it does not seem to work on my 2.8.
?
by Jehzeel Laurente on 20 October, 2009 at 06:49
Exactly what I'm looking for. Thanks for this Joost! :)