Last active
August 29, 2015 14:18
-
-
Save PeterBooker/a25d87b38ac6780a0bc6 to your computer and use it in GitHub Desktop.
WordPress Auto Updates Plugin Whitelist
This file contains hidden or 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 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