Skip to content

Instantly share code, notes, and snippets.

@jordantrizz
Forked from koconder/disable-updates.php
Created January 8, 2021 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordantrizz/934dd06dd00fd6229ed2c545c090985b to your computer and use it in GitHub Desktop.
Save jordantrizz/934dd06dd00fd6229ed2c545c090985b to your computer and use it in GitHub Desktop.
<?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;" ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment