Created
August 15, 2022 04:06
-
-
Save PatelUtkarsh/2596d6a30950e5706dc0dfd65836bb13 to your computer and use it in GitHub Desktop.
Disable plugin updates WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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