Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created November 21, 2014 13:33
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 westonruter/1e76731a363fb5d5dba3 to your computer and use it in GitHub Desktop.
Save westonruter/1e76731a363fb5d5dba3 to your computer and use it in GitHub Desktop.
<?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