Skip to content

Instantly share code, notes, and snippets.

@PeterBooker
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PeterBooker/a25d87b38ac6780a0bc6 to your computer and use it in GitHub Desktop.
Save PeterBooker/a25d87b38ac6780a0bc6 to your computer and use it in GitHub Desktop.
WordPress Auto Updates Plugin Whitelist
<?php
/*
* Plugin Auto Updates Whitelist
* Allows Forced Updates for listed Plugin Slugs
*/
function prefix_forced_update_whitelist_plugins( $update, $item ) {
// Examples, please add plugin slugs that you trust.
$plugins = array (
'jetpack', 'wordpress-seo', 'plugin-slug',
);
if ( in_array( $item->slug, $plugins ) ) {
// Allow WP to decide
return $update;
} else {
// Block all others
return false;
}
}
add_filter( 'auto_update_plugin', 'prefix_forced_update_whitelist_plugins', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment