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?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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:
- No update nag plugin can do (some of) this for you as well
- Disable WordPress Core Updates
Bonus
To find out how to exclude specific plugins from updating:
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0