Skip to content

Instantly share code, notes, and snippets.

@willmot
Created May 29, 2012 21:08
Show Gist options
  • Save willmot/2830722 to your computer and use it in GitHub Desktop.
Save willmot/2830722 to your computer and use it in GitHub Desktop.
Disable core, theme and plugin update checks and notices and remove the update page from nav
<?php
// Don't disable on dev
if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
// Disable core update checking
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
remove_action( 'admin_init', '_maybe_update_core' );
remove_action( 'wp_version_check', 'wp_version_check' );
// Remove the updates menu item
function yell_remove_update_menu() {
remove_submenu_page( 'index.php', 'update-core.php' );
}
add_filter( 'admin_menu', 'yell_remove_update_menu' );
// Disable plugin update checking
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'load-update-core.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
remove_action( 'wp_update_plugins', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
// Disable theme update checking
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'load-update-core.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );
remove_action( 'wp_update_themes', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
}
@pbaylies
Copy link

Very nice; for WordPress 3.4+, you can now consider using __return_null here as well, instead of create_function().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment