Skip to content

Instantly share code, notes, and snippets.

@BruceMcKinnon
Created January 27, 2025 23:18
Show Gist options
  • Save BruceMcKinnon/db2d13cb8de151f8a6c67a427dff8cf0 to your computer and use it in GitHub Desktop.
Save BruceMcKinnon/db2d13cb8de151f8a6c67a427dff8cf0 to your computer and use it in GitHub Desktop.
Disable updating of a Wordpress Plugin(s)
//
// Disable updates to a plugin - solution found on https://wordpress.stackexchange.com/questions/397326/how-do-i-disable-an-update-for-a-specific-plugin
//
function AS_disable_plugin_updates( $value ) {
//create an array of plugins you want to exclude from updates ( string composed by folder/main_file.php)
$pluginsNotUpdatable = [
'plugin1/plugin.php',
'plugin2/plugin2.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', 'AS_disable_plugin_updates' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment