Created
December 16, 2019 03:41
-
-
Save anonymousraft/ead5401a26d3a702ac4f91ad09eb8829 to your computer and use it in GitHub Desktop.
updating specific plugin in wordpress
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
| function auto_update_specific_plugins ( $update, $item ) { | |
| // Array of plugin slugs to always auto-update | |
| $plugins = array ( | |
| 'akismet', | |
| 'buddypress', | |
| ); | |
| if ( in_array( $item->slug, $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; | |
| } | |
| } | |
| add_filter( 'auto_update_plugin', 'auto_update_specific_plugins', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment