Skip to content

Instantly share code, notes, and snippets.

@Kenshino
Forked from PeterBooker/autoupdate_plugins.php
Last active August 29, 2015 14:18
Show Gist options
  • Save Kenshino/729d1757e55544ff4ab6 to your computer and use it in GitHub Desktop.
Save Kenshino/729d1757e55544ff4ab6 to your computer and use it in GitHub Desktop.
<?php
/*
* Plugin Auto Updates Whitelist
* Allows Forced Updates for listed Plugin Slugs
*/
function pb_auto_update_whitelist_plugins( $update, $item ) {
// Array of plugin slugs to whitelist
$plugins = array (
'jetpack',
'wordpress-seo',
'plugin-slug',
);
if ( in_array( $item->slug, $plugins ) ) {
// Allow listed to be force updated
return $update;
} else {
// Block all others
return false;
}
}
add_filter( 'auto_update_plugin', 'pb_auto_update_whitelist_plugins', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment