Skip to content

Instantly share code, notes, and snippets.

@mdemrs
Last active August 29, 2015 14:16
Show Gist options
  • Save mdemrs/c5bc04b6ec88f4b47a0a to your computer and use it in GitHub Desktop.
Save mdemrs/c5bc04b6ec88f4b47a0a to your computer and use it in GitHub Desktop.
wp: to disable update notifications
//www.wpoptimus.com/626/7-ways-disable-update-wordpress-notifications/
//To Disable Update WordPress nag
add_action('after_setup_theme','remove_core_updates');
function remove_core_updates(){
if(! current_user_can('update_core')){return;}
add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2);
add_filter('pre_option_update_core','__return_null');
add_filter('pre_site_transient_update_core','__return_null');
}
//To Disable Plugin Update Notifications
remove_action('load-update-core.php','wp_update_plugins');
add_filter('pre_site_transient_update_plugins','__return_null');
// Hide wordpress update alert
add_action('admin_menu', 'wpc_wphidenag');
function wpc_wphidenag(){
remove_action('admin_notices', 'update_nag', 3);
}
//OR To Disable all the Nags & Notifications
function remove_core_updates(){
global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
}
add_filter('pre_site_transient_update_core','remove_core_updates');
add_filter('pre_site_transient_update_plugins','remove_core_updates');
add_filter('pre_site_transient_update_themes','remove_core_updates');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment