Useful when you modify a plugin, and don't want another WP admin to update it, discarding your changes.
- Add this snippet at the top of your plugin's main file.
- Replace
xyz
for some short version of your plugin's name - That's it. See screenshot:
<?php | |
// Block the admin from updating this plugin, as we've modified it. | |
add_filter('site_transient_update_plugins', function ($value) { | |
$plugin = plugin_basename(__FILE__); | |
if (!isset($value->response[ $plugin ])){ return $value; } | |
add_action( "in_plugin_update_message-$plugin", function ($plugin_data){ | |
echo " A customized version is being used. Please contact your developer for updates."; | |
}); | |
unset($value->response[ $plugin ]->package); // Remove ->package to fully remove the update notice. | |
return $value; | |
}); |