1

I'm interested in using an old version of a plugin for a core feature on the site (it's not ideal but a compromise after months of effort) because the new version has incompatibilities. However I'm worried that someone - including myself - will mindlessly update the plugin in the future.

Is there any way to prevent a WordPress plugin from searching for updates?

3 Answers 3

3

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.

1

You can easily stop WordPress plugins from searching for updates just with this code:

function filter_plugin_updates( $value ) {
unset( $value->response['PATH_TO_PLUGIN_MAIN_FILE'] ); //Replace the path with main PHP file of your plugin.
return $value;}
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );

I have written a complete blog post on it. Here is my blog post - Prevent a WordPress plugin from searching for updates. This blog will show you how and wheere to use this blog. And also give you the suggestion to use it in perfect place.

Source: https://www.codespeedy.com/prevent-a-wordpress-plugin-from-searching-for-updates/

1
  • Could you please explain how is this different from the other answer? Apart of the fact that you link to your post? Commented Dec 18, 2016 at 0:36
0

One-Line version is also good to insert into current plugin's construction:

add_filter('site_transient_update_plugins', function ($value) { if ( isset($value->response[$name=plugin_basename(__FILE__)]) ) { unset($value->response[$name]); }   return $value; });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.