Skip to content

Instantly share code, notes, and snippets.

@kagg-design
Last active November 20, 2018 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kagg-design/445e14aabfcb931b6eb210ca7a54afa8 to your computer and use it in GitHub Desktop.
Save kagg-design/445e14aabfcb931b6eb210ca7a54afa8 to your computer and use it in GitHub Desktop.
Disable update of certain plugins.Put this file into /wp-content/mu-plugins/
<?php
/**
* Plugin Name: Disable updates plugins
* Plugin URI: https://kagg.eu/en/
* Description: Disable update of certain plugins.
* Version: 1.0
* Author: KAGG Design
* Author URI: https://kagg.eu/en/
* License: GPL2
*/
/**
* @param mixed $value
*
* @return mixed
*/
function filter_update_plugins( $value ) {
// Array of plugin slugs.
$disable_update_plugins = array(
'akismet',
);
if ( ! isset( $value->response ) ) {
return $value;
}
foreach ( $value->response as $name => $plugin ) {
foreach ( $disable_update_plugins as $disable_update_plugin ) {
if ( stripos( $name, $disable_update_plugin ) !== false ) {
unset( $value->response[ $name ] );
}
}
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'filter_update_plugins' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment