How to hide (disable) plugins update notification & auto update plugins (without using any other plugin but codes)?

Working as a freelancer, I have worked on several WordPress websites, and manually updating plugins on each site is very tedious, thus I always apply these codes to automate the things. Additionally, when we customize certain plugins, I don’t want it to be updated as everything will be swiped away on the update, thus disabling the update notification has done the trick.

Using very simple codes and without using any third-party plugins, you can choose to disable plugin update notification and as well automatically update plugins. However, please note, plugin update can take up to 12hours for updating. So please don’t expect the plugins to get auto-updated as soon as the code is applied.

Codes to be added on functions.php (to disable plugin update notification):

/*Disable update and hide plugin update notifcation */

function disable_any_plugin_updates( $value ) {
$Disableplugins = [
‘write-the-plugin-name’
];
if ( isset($value) && is_object($value) ) {
foreach ($Disableplugins as $plugin) {
if ( isset( $value->response[$plugin] ) ) {
unset( $value->response[$plugin] );
}
}
}
return $value;
}
add_filter( ‘site_transient_update_plugins’, ‘disable_any_plugin_updates’ );


/*code ends */


Codes ta auto-update plugins
/*auto update all the plugins */

add_filter( ‘auto_update_plugin’, ‘__return_true’ );


/*code ends */

For more codes please click this link.






SUBSCRIBE

SUBSCRIBE

Welcome to Hey, Let's Learn Something!

Please sign up here to receive the latest updates on our blogs, tutorials and download section :)

Thank you for subscribing :)