Skip to content

Instantly share code, notes, and snippets.

@rniswonger
Last active January 3, 2024 15:21
Show Gist options
  • Save rniswonger/ee1b30e5fd3693bb5f92fbcfabe1654d to your computer and use it in GitHub Desktop.
Save rniswonger/ee1b30e5fd3693bb5f92fbcfabe1654d to your computer and use it in GitHub Desktop.
WordPress - Disable specific plugin update check
/**
* 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 ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
@deanoakley
Copy link

deanoakley commented Aug 9, 2021

I thought this was cool. I made a version you can place in the main plugin file with no edits. https://gist.github.com/deanoakley/e05b9a037c5afce473b26b224a62cff5

/**
 * Prevent update notification for plugin - 
 * http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
 * Add to the core plugin file 
 */
function disable_plugin_updates( $value ) {
  if ( isset($value) && is_object($value) ) {
  $plugin_file_name = basename(__DIR__) . '/' . basename(__FILE__);
    if ( isset( $value->response[$plugin_file_name] ) ) {
      unset( $value->response[$plugin_file_name] );
    }
  }
  return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );

@usmansadiq786
Copy link

+1

@emjwey
Copy link

emjwey commented Oct 12, 2021

Thanks!

@giahojnost
Copy link

Thank you very much!!

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