Created
February 26, 2017 01:24
-
-
Save neilgee/86e111f8483a7c1a01888e66d9b70b6b to your computer and use it in GitHub Desktop.
Don't Update Some WordPress 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 | |
/* | |
Plugin Name: Don't Update Some Plugins | |
Plugin URI: https://wpbeaches.com | |
Description: This doesn't update some plugins | |
Author: Neil Gowran | |
Author URI: https://wpbeaches.com | |
License: GPL2 | |
*/ | |
add_filter( 'auto_update_plugin', 'do_not_auto_update_specific_plugins', 10, 2 ); | |
// Don't update some plugins | |
function do_not_auto_update_specific_plugins ( $update, $item ) { | |
// Array of plugin slugs to never auto-update | |
$plugins = array ( | |
'akismet', | |
'duplicator', | |
); | |
if ( in_array( $item->slug, $plugins ) ) { | |
return false; // Never update plugins in this array | |
} else { | |
return true; // Else update the rest | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment