Skip to content

Instantly share code, notes, and snippets.

@ebetancourt
Forked from rniswonger/wp-disable-plugin-update.php
Last active November 18, 2024 16:54
Show Gist options
  • Save ebetancourt/89b105d7334495535415799832511938 to your computer and use it in GitHub Desktop.
Save ebetancourt/89b105d7334495535415799832511938 to your computer and use it in GitHub Desktop.
WordPress - Disable specific plugin update check
<?php
// have to add that opening tag to get syntax highlighting... ¯\_(ツ)_/¯
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
$pluginsToDisable = [
'plugin-folder/plugin.php',
'plugin-folder2/plugin2.php'
];
if ( isset($value) && is_object($value) ) {
foreach ($pluginsToDisable as $plugin) {
if ( isset( $value->response[$plugin] ) ) {
unset( $value->response[$plugin] );
}
}
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
@cliffordp
Copy link

Plugin to do this for files with version control: https://github.com/cliffordp/tk-exclude-vcs-updates

@inspiredearth
Copy link

Thanks. This works great.
Is there a relatively easy way to have some text display next to plug-ins (for which updates are disabled), indicating they are disabled?

@iamthekwan
Copy link

Beautiful. Thanks so much.

@artmaug
Copy link

artmaug commented Sep 12, 2021

Works like a charm, thanks!

@emjwey
Copy link

emjwey commented Oct 12, 2021

Sweet! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment