Created
November 21, 2014 13:33
-
-
Save westonruter/1e76731a363fb5d5dba3 to your computer and use it in GitHub Desktop.
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 | |
class WMR_Auto_Upgrade { | |
public $whitelisted_plugins = array( | |
'akismet', | |
'customizer-everywhere', | |
'dependency-minification', | |
'jetpack', | |
'media-placeholders', | |
'posts-to-posts', | |
'safe-redirect-manager', | |
'stream', | |
); | |
function __construct() { | |
add_filter( 'automatic_updates_is_vcs_checkout', '__return_false', 1 ); | |
define( 'WP_AUTO_UPDATE_CORE', true ); | |
add_filter( 'auto_update_plugin', array( $this, 'auto_update_plugin' ), 10, 2 ); | |
} | |
/** | |
* @param $update | |
* @param $item | |
* | |
* @return bool | |
*/ | |
function auto_update_plugin( $update, $item ) { | |
if ( in_array( $item->slug, $this->whitelisted_plugins ) ) { | |
$update = true; | |
} | |
return $update; | |
} | |
} | |
$wmr_auto_upgrade = new WMR_Auto_Upgrade(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment