Created
August 21, 2020 23:02
-
-
Save wpsmith/8d52cba17cd6f3e503658dbb2ad0ced0 to your computer and use it in GitHub Desktop.
WP: Auto-update whitelisted set of plugins.
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 | |
add_filter( 'auto_update_plugin', 'wps_auto_update_specific_plugins', 10, 2 ); | |
function wps_auto_update_specific_plugins ( $update, $item ) { | |
// Array of plugin slugs to always auto-update | |
$plugins = array ( | |
'akismet', | |
'enhanced-media-library', | |
'duplicate-page', | |
); | |
if ( in_array( $item, $plugins ) ) { | |
// Always update plugins in this array | |
return true; | |
} else { | |
// Else, use the normal API response to decide whether to update or not | |
return $update; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment