Skip to content

Instantly share code, notes, and snippets.

@bueltge
Forked from WordPress-Handbuch/listing-13-1.php
Last active February 21, 2021 23:10
Show Gist options
  • Save bueltge/1359c53fd799232422f66cd9c189be14 to your computer and use it in GitHub Desktop.
Save bueltge/1359c53fd799232422f66cd9c189be14 to your computer and use it in GitHub Desktop.
Plugin to include only specific plugins in the automatic updates
<?php
/**
* Plugin Name: Control plugin update.
* Description: xyz
* Plugin URI: https://wpbuch.com/listing-13-1
* Version: 1.0.0
* Author:
* Author URI:
* Licence: GPLv2+
*/
function auto_update_specific_plugins ( $update, $item ) {
// List your plugins to be updated here
$plugins = array (
'cookie-notice',
'relevanssi',
'updraftplus',
'and-any-other-plugin-slugs',
);
if ( in_array( $item->slug, $plugins ) ) {
return true;
}
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