Sunday, 3 March 2019

Disable plugin updates in WordPress with hook

There may be a time/requirement/situation when you have to disable the plugin updates in backend, to do that we would be using the following hook:
add_filter( 'site_transient_update_plugins', 'your-custom-function' );
Waning: Below steps are only for those who knows and have Idea of customization in WordPress, also before proceeding its strongly recommended to take full theme/website backup, and to make such changes only use FTP or cPanel.

To disable the update we would be using the following steps:

1) Go to WordPress themes folder either through FTP or through cPanel or your local server.
2) Now find the theme name which is active and look for "functions.php" file in it and open that in your code editor. (I believe before that you have already taken the backup of theme.)
3) Now add the following code at the very bottom of your functions.php file.

function stop_plugin_updates( $value ) {
    unset( $value->response['name-of-plugin/plugin-file-name-with-file-extension'] );
    return $value;
}
add_filter( 'site_transient_update_plugins', 'stop_plugin_updates' );  
4) Now go to your admin side and look for plugins which is showing plugin update message.
5) Now go to plugins folder through FTP or local server of the project and look for plugin which is showing the updates in admin; copy the name of the plugin exactly in the same format as shown in the plugin folder and add in place of "name-of-plugin".
6) Now open that plugin folder and look for a file which contains all information like: name of plugin, version , author etc; now in place of "plugin-file-name-with-file-extension" on above code add file name with extension.
7) Now save the file (On FTP you have to upload to server).
8) Go to admin side and see plugin has stopped to show updates warning.

Video demonstration of above steps:



Version at the time of demonstration:
1) WordPress: Version 5.1
2) Local server: WampServer Version 3.1.7 64bit
3) Code Editor: Sublime Text Version 3.1.1 Build 3176
4) OS: Window 7 Home basic.
Load disqus comments

0 comments