Skip to content

Instantly share code, notes, and snippets.

@PatelUtkarsh
Created August 15, 2022 04:06
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 PatelUtkarsh/2596d6a30950e5706dc0dfd65836bb13 to your computer and use it in GitHub Desktop.
Save PatelUtkarsh/2596d6a30950e5706dc0dfd65836bb13 to your computer and use it in GitHub Desktop.
Disable plugin updates WordPress
<?php
// Return zero updates and current time as last checked time
function __disable_wp_updates() {
include ABSPATH . WPINC . '/version.php';
return (object) array(
'updates' => array(),
'version_checked' => $wp_version,
'last_checked' => time(),
);
}
// Disable Plugin Updates
remove_action( 'load-update-core.php', 'wp_update_plugins' );
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'wp_update_plugins', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', '__disable_wp_updates' );
// Disable Theme Updates
remove_action( 'load-update-core.php', 'wp_update_themes' );
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'wp_update_themes', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', '__disable_wp_updates' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment