How can I prevent a plugin from searching for updates?

It is quite simple. All you have to do is add some code in a Custom Functions plugin.

Lets say you want to block the “Hello Dolly” plugin (comes prepacked with WordPress) from updating. In your “My Functions Plugin”, mycustomfunctions.php (you can use any name really) you place the following:

/* Disable a plugin from updating */
function disable_plugin_updating( $value ) {
   unset( $value->response['hello.php'] );
   return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updating' );

That is all.
Now in case you want to prevent more than one plugins from updating, you just add additional lines to the above code like this:

/* Disable some plugins from updating */
function disable_plugin_updating( $value ) {
   unset( $value->response['hello.php'] );
   unset( $value->response[ 'akismet/akismet.php' ] );
   return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updating' );

Things to notice:

  • It is always best practice to keep everything updated to the latest version (for obvious reasons and mainly for vulnerability issues).

  • We use akismet/akismet.php because akismet.php is within the plugin folder akismet

  • In case you are not aware of what a Custom Functions plugin is (or don’t have one) you can easily create one. Please have a look at an old -but still very valid- post on: Creating a custom functions plugin for end users.

  • Also, please have a look at this post about: Where to put my code: plugin or functions.php.

Leave a Comment