rasti-at-webkinder
10/26/2016 - 8:40 AM

Disable/Enable automatic updates in WordPress

Disable/Enable automatic updates in WordPress




/*----------------------------------------
# 
# DISABLE/ENABLE WORDPRESS UPDATES
# 
----------------------------------------*/

add_filter( 'automatic_updater_disabled', '__return_true' );            // disable all automatic updates

// enable all core-type updates only
// add_filter( 'auto_update_core', '__return_true' );                      // to disable set __return_false

// add_filter( 'allow_dev_auto_core_updates', '__return_true' );           // Enable development updates 
// add_filter( 'allow_minor_auto_core_updates', '__return_true' );         // Enable minor updates
// add_filter( 'allow_major_auto_core_updates', '__return_true' );         // Enable major updates

// add_filter( 'automatic_updates_is_vcs_checkout', '__return_false', 1 ); // enable automatic updates even if a VCS folder (.git, .hg, .svn etc)

// PLUGIN & THEMES UPDATES

// add_filter( 'auto_update_plugin', '__return_true' );                    // Automatic updates for All plugins
// add_filter( 'auto_update_theme', '__return_true' );                     // Automatic updates for All themes

// enable auto-updates for specific plugins only
// 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 ) ) {
//         return true; // Always update plugins in this array
//       } else {
//         return $update; // Else, use the normal API response to decide whether to update or not
//     }
// }
// add_filter( 'auto_update_plugin', 'auto_update_specific_plugins', 10, 2 );

// enable translation file updates
// add_filter( 'auto_update_translation', '__return_true' );

// disable update notification emails
// add_filter( 'auto_core_update_send_email', '__return_false' );