Last active
November 20, 2018 12:56
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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