Introduction

On rare occasions (ideally never but sometimes you can't help it) you may find yourself in a situation where you don't want a specific WordPress plugin to get updated. Maybe there was a breaking change introduced in a new version, or maybe you had to customize a plugin to meet a specific need (I'm so sorry). In any case you may find yourself wanting to disable updates for a specific plugin.

The Code

You can put this code in your theme's functions.php file to prevent the specified plugins from being updated. Make sure to replace plugin-directory/main-plugin-file.php with the path to the plugin(s) you want to disable updates for.

functions.php

function disable_plugin_updates($value) {
  // create an array of plugins you want to exclude from updates (string composed by plugin-directory/main-plugin-file.php)
  $pluginsNotUpdatable = [
    'plugin-directory/main-plugin-file.php',
  ];

  if (isset($value) && is_object($value)) {
    foreach ($pluginsNotUpdatable as $plugin) {
        if (isset($value->response[$plugin]) ) {
            unset($value->response[$plugin]);
        }
      }
  }
  return $value;
}
add_filter('site_transient_update_plugins', 'disable_plugin_updates');