Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So far I've been using the following code to remove the dashboard update message ("WordPress 3.5 is available! Please update now."):

remove_action('wp_version_check', 'wp_version_check');
remove_action('admin_init', '_maybe_update_core');
add_filter('pre_transient_update_core', create_function( '$a', "return null;"));

However, it doesn't seem to work any more with current WordPress versions. Is there a new way to removing this message that is compatible with later WordPress versions?

share|improve this question
    
When asking such questions, please note, what you mean with "current WordPress versions". –  feeela Dec 19 '12 at 11:08
    
Ok. I'm using WP 3.4.2. –  drake035 Dec 19 '12 at 19:45
add comment

1 Answer

up vote 5 down vote accepted

How to hide WordPress update mesages

CSS

The low-tech way to hide something is using css:

// Low-tech hiding of update-mesages
// source: http://wpsnipp.com/index.php/functions-php/hide-update-nag-within-the-admin/
function remove_upgrade_nag() {
   echo '<style type="text/css">
           .update-nag {display: none}
         </style>';
}
add_action('admin_head', 'remove_upgrade_nag');

This more-or-less works, but it is a lot of work to find al the places WordPress shows messages.

Add_action

A better way is using actions. The wordpress-core (core in this context is WordPress itself) update messages are triggered in wp-admin/includes/update.php, line 84 core_update_footer, and line 139 with the great name update_nag. We can use actions to disable these:

//hide core updates notification in the dashboard
function hide_wp_update_nag() {
    remove_action( 'admin_notices', 'update_nag', 3 ); //update notice at the top of the screen
    remove_filter( 'update_footer', 'core_update_footer' ); //update notice in the footer
}
add_action('admin_menu','hide_wp_update_nag');

As an alternative to:

add_action( 'admin_notices', 'update_nag', 3 );

You might want to use, for multi-site:

add_action( 'network_admin_notices', 'update_nag', 3 );

The dashboard notifications are a bit harder, bit this should do the job:

//hide plugin updates notification in the dashboard
function hide_plugin_update_indicator(){
    global $menu,$submenu;
    $menu[65][0] = 'Plugins';
    $submenu['index.php'][10][0] = 'Updates';
}
add_action('admin_menu', 'hide_plugin_update_indicator');

Although the update notices are hidden, it is still possible to see that something needs to be updated on the following pages (and do the updates):

  • /wp-admin/update-core.php
  • /wp-admin/themes.php
  • /wp-admin/plugins.php

Disabling updates

If you completely want to disable updates, use:

//http://codex.wordpress.org/Transients_API
add_filter('pre_site_transient_update_core', create_function('$a', "return null;")); // disable core update
add_filter('pre_site_transient_update_plugins', create_function('$a', "return null;")); // disable plugin update
add_filter('pre_site_transient_update_themes', create_function('$a', "return null;")); // disable theme update

This will completely disable updates for core, plugins and themes.

Plugins

You might put this code in a functionality plugin, so it works in all themes.

Some ready-made plugins:

Bonus

To find out how to exclude specific plugins from updating:

share|improve this answer
    
Don't do the pre_site_transient_ filters, it forces continuous checks for updates (although they don't get displayed). A better approach hides the messages but avoids the overhead. –  El Yobo Feb 18 '13 at 11:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.