WordPress 5.6 will allow you to easily enable or disable automatic updates

autoupdates

WordPress 5.6, available from December 8th, 2020, includes the ability to easily set up automatic updates in the background, without user intervention, not only for major versions, but also for minor versions.

Until now, it was already possible to activate major updates automatically, by means of a constant in the wp-config.php file:

define( 'WP_AUTO_UPDATE_CORE', true );
Code language: JavaScript (javascript)

But from WordPress 5.6 there is a new setting, with which you can turn them on or off with a single click, without having to modify any files.

This will include a new checkbox in the update management screen, where site administrators can check the web to enable major updates automatically or not.

update settings in admin bar
new auto-update settings

By the way, you can also include in this same screen a box from which to activate or deactivate the minor updates.

To do this you must add the following code to your customization plugin:

/* Checkbox to activate minor auto-updates */ function my_plugin_after_core_auto_updates_settings_fields( $auto_update_settings ) { if ( isset( $_POST['core-auto-updates-settings'] ) && wp_verify_nonce( $_POST['set_core_auto_updates_settings'], 'core-auto-updates-nonce' ) ) { if ( isset( $_POST['my-plugin-core-auto-updates-minor'] ) && 1 === (int) $_POST['my-plugin-core-auto-updates-minor'] ) { update_site_option( 'my_plugin_auto_update_core_minor', 1 ); } else { update_site_option( 'my_plugin_auto_update_core_minor', 0 ); } } $minor_auto_updates_settings = get_site_option( 'my_plugin_auto_update_core_minor' ); ?> <p> <input type="checkbox" name="my-plugin-core-auto-updates-minor" id="my-plugin-core-auto-updates-minor" value="1" <?php checked( $minor_auto_updates_settings, 1 ); ?> /> <label for="my-plugin-core-auto-updates-minor"> <?php _e( 'Mantén este sitio actualizado con las versiones menores.', 'my-plugin' ); ?> </label> </p> <?php } add_action( 'after_core_auto_updates_settings_fields', 'my_plugin_after_core_auto_updates_settings_fields', 10, 1 );
Code language: PHP (php)

Once the changes have been saved, the new box will be displayed in this section.

new auto-update settings including minor ones

Actually there is no new functionality in WordPress, since the minor automatic updates were already active by default, and the major ones could be activated, but at least in WordPress 5.6 you can have a checkbox to make this decision more easily.

Of course, the wp-config.php constant will still work, so you can disable all these automatic updates, both the major and minor ones, this one:

define('AUTOMATIC_UPDATER_DISABLED', true);
Code language: JavaScript (javascript)

And a filter may also be incorporated to hide the activation box for major updates, to avoid surprises to uninformed administrators.

Read this post in Spanish: WordPress 5.6 permitirá activar o desactivar las actualizaciones automáticas fácilmente

Click to rate this post!
[Total: 1 Average: 5]

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top Skip to content