WordPress Automatic Update – How do I config & control it?

WordPress Automatic Update has been introduced from WordPress 3.7+ This release is mainly focused on improving security and stability of WordPress. Most sites are now able to automatically apply these updates in the background. By default, your WordPress site will update itself when a new minor or security update is released. Fortunately, you’ll still need to click Update Now for major feature releases to avoid incompatible with your themes and plugins.
The WordPress Automatic Update activated and running in background, no configuration options are exposed in the UI. To change the behavior, you’ll need to modify your wp-config.php file, or using filters allows for fine-tuned control of automatic updates. The best place to put these filters is in a must-use plugin.

WordPress Update Types

In WordPress, there are four types of automatic background updates:

  1. Core updates
  2. Plugin updates
  3. Theme updates
  4. Translation file updates

Why and Who Would Want to Control Automatic Updates

WordPress Automatic Updates running in background is not best solution for all purposes because your hacks, themes, plugins is not ready for newest version of WordPress, especially the major update. Any automatic updates will override and erase your hacks or break your website with unsupported or deprecated functions and old features.

Don’t forget to backup your WordPress to prevent lost your hacks, customization … In order to accomplish this with automatic updates you may need to automate your backups too.

Control & Config WordPress Automatic Updates

To enable automatic updates for major releases or development purposes, the place to start is with the WP_AUTO_UPDATE_CORE constant.

Core Update Control

Update core – development

// Update core - development, major, and minor versions
define( 'WP_AUTO_UPDATE_CORE', true );

Update core – minor versions

// Update core - minor versions
define( 'WP_AUTO_UPDATE_CORE', 'minor' );

WP_AUTO_UPDATE_CORE can be defined with one of three values, each producing a different behavior:

  • Value of true – Development, minor, and major updates are all enabled
  • Value of false – Development, minor, and major updates are all disabled
  • Value of minor – Minor updates are enabled, development, and major updates are disabled

You can do it via filters:

// Enable nighties (dev updates):
add_filter( 'allow_dev_auto_core_updates', '__return_true' );
// Enable major version updates:
add_filter( 'allow_major_auto_core_updates', '__return_true' );
// Disable minor updates
add_filter( 'allow_minor_auto_core_updates', '__return_false' );
Note: Do not add add_filter() calls in wp-config.php – causes conflicts with WP-CLI and possibly other problems.

Disable WordPress Automatic Updates

If you want to disable the WordPress auto updates completely, open the wp-config.php file and add this line to it:

define( 'AUTOMATIC_UPDATER_DISABLED', true );

Alternatively, add the following filter:

add_filter( 'automatic_updater_disabled', '__return_true' );
If you disable WordPress auto updates completely, that will disable both plugins, themes and core auto updates no mater what configurations you’ve made for themes or plugins.

Control Plugins and Themes updates

Automatic plugin and theme updates are disabled by default. If you want your plugins to be automatically updated by WordPress when a new version is released you need addition filters:
To enable automatic updates for plugins, use the following:

add_filter( 'auto_update_plugin', '__return_true' );

To enable automatic updates for themes, use the following:

add_filter( 'auto_update_theme', '__return_true' );
This will work only if your theme is downloaded from the official WordPress repository. If you’re using a paid themes or plugins, you need update it manual or use their update tools.

Translation Updates

Automatic translation file updates are already enabled by default, the same as minor core updates. To disable it, we need a filter:

// Disable translation updates
add_filter( 'auto_update_translation', '__return_false' );

Manipulate Update Result Emails

The result email comes in three forms:

  • A successful update. Nice!
  • An update that couldn’t occur. As in, WordPress tried to update, but failed early, like an inconsistent permissions error it was able to catch.
  • A critical failure, when the update failed in the middle of copying files.

The updater sends a result email on success, failure, or critical error. To config via filter:

/* @param bool   $send        Whether to send the email. Default true.
 * @param string $type        The type of email to send.
 *                            Can be one of 'success', 'fail', 'critical'.
 * @param object $core_update The update offer that was attempted.
 * @param mixed  $result      The result for the core update. Can be WP_Error.
 */
apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result );

Or disable update emails

// Disable update emails
add_filter( 'auto_core_update_send_email', '__return_false' );

Use plugin to manage WordPress Updates

As you see, to modify WordPress Updates settings, you need edit your wp-config.php or add the filters to plugin files. Fortunately, we can change them by use Advanced Automatic Updates plugin.

Advanced Automatic Updates
Advanced Automatic Updates

If you’re working on a WordPress Multisite install, it will properly restrict the options page to your Network Admin.

ManageWP is third-party service that can help you bulk update WordPress Core, Plugins, Themes with only one click. Among many other awesome features.

Conclusion

Auto updates for WordPress are not the right solution for everyone.
What are your thoughts automatic updates?
Since the auto updates are only for minor updates I’m happy to go along with them and they do save a lot of time.
If you choose to keep auto update active how can you be sure that updates won’t break compatibility with anything installed?
Don’t be concerned. Minor releases don’t break things.
Would you keep them enabled or use the above method to disable them? Let us know in the comments below!

, ,

No comment yet, add your voice below!


Add a Comment

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

Comment *
Name *
Email *
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.