WordPress automatic updates were introduced with the version 3.7. The release’s focus was to improve the stability and the security of WordPress. The automatic update ensures that WordPress can automatically update and replace the deprecated or outdated code in the database and files without the permission of the user. Most of the sites now are able to apply these updates automatically in the background.
The WordPress site would be able to update itself when a security update has been released. However, the users still get to click on ‘Update Now’ in order to update any major releases so as to avoid any incompatibility with the plugins or the themes.
The WordPress Automatic Update automatically runs in the background and no configuration is exposed to the User Interface. The auto update feature is great for security but the version upgrades can at times cause compatibility issues. This might lead to breakages which might take hours to resolve and no one wants that. Shown below is the best way to manage the auto updates of WordPress easily.
Elements of WordPress Updates
There are four types of automatic updates in WordPress.
- Core Update
- Theme Update
- Plugin Update
- Translation File Update
You must have the wp-config.php open to get started.
WordPress Core Updates
The core updates are automatic for the minor and development updates. WordPress wouldn’t update automatically if the version that has been released is a major one like version 5.2 or 5.3. The constant WP_AUTO_UPDATE_CORE of WordPress shows how the automatic core updates can be handled easily. It can be set to any of the three following values.
- True- Enables the entire core updates
- False- Disables the entire core updates
- Minor- the default value, this only updates on the minor releases and when the development version is run.
You also get the option to specify which core update you would want to automate by adding filters and then setting the return value to true. For instance, you can add- allow_minor_auto_core_updates for the automated updates related only to the minor version.
Themes also get automatically updated when the developers of the WordPress core issue the auto-update command with the help of API response. This can cause a problem for websites if not handled carefully. To disable the automatic theme update feature, you would need to use the below-listed filter:
add_filter( ‘auto_update_theme’, ‘__return_false’ );
This can be changed when required by changing the ‘return false’ filter to ‘return true’.
The WordPress plugin updates automatically only when the API response from the WordPress.org returns a non-empty property of auto update. This can only happen when the developer team of WordPress updates a plugin and then makes use of an API response to issue an auto-update command. However, the new updates for the plugin can break the site as you cannot be sure if they are compatible with the site. Therefore, to disable the automatic update for plugins, one can use the below-listed filter:
add_filter( ‘auto_update_plugin’, ‘__return_false’ )
In case, you want to enable it, you can change the filter from ‘return false’ to ‘return true’.
The translation for the core files are updated automatically and the managed separately. In order to prevent this, you can the following filter:
add_filter( ‘auto_update_translation’, ‘__return_false’ )
All Updates of WordPress
If you want to disable all the automatic updates instead of selectively enabling or disabling the different types, you can do that too. A value, whether true or false would has to be defined for the constant which is- AUTOMATIC_UPDATER_DISABLED through the wp-config.php with –
define( ‘AUTOMATIC_UPDATER_DISABLED’, true )
This would disable any kind of automatic updates. If you want to enable them, then you can do so easily by setting the value back to false.
After this, we have the filter – automatic_updater_disabled. One of the two return values can be set for this function.
add_filter( ‘automatic_updater_disabled’, ‘__return_true’ )
This would disable all the automatic updates even if there has been any previous configuration. You can do so by – replace __return_true with __return_false. You can also do this more easily by removing the filter from the file itself to enable it back.
Another important way of disabling the entire filter is disallow_file_mods.
define (‘DISALLOW_FILE_MODS’, true)
When set to true, this constant can work on to disable the entire above-mentioned auto updates, plugin editors, themes as well as the installation of plugins and newer themes. This would also prevent the users from updating themes, core or plugins, overriding any auto-update related filters and constants and hide any plugin or theme update notifications.
In case you plan to hire a reliable WordPress host with plenty of services including maintaining your website, you must understand that this is how they work on to manage the updates. The notifications for the core update, however, would still appear in the dashboard. But, it would only ask the user to notify the administrator of the site. If you have hired professional developers to maintain and manage your site round the clock, they would disable them.
Using Plugins to Manage WordPress Updates
As seen above, in order to modify the WordPress auto updates, you would need to edit the wp-config.php or add the filters to the plugin files. However, if you do not wish to follow that, you can also do that with the help of the plugins. In case, you are working on a WordPress Multisite install, it would automatically restrict the page options to that of the Network Admin. There are several third-party services that can help you to do so easily.
Auto Updates for WordPress might not be for everyone and therefore you can modify them to make sure that they don’t hamper your website. All the codes might look a bit confusing and complex but all you need to do is define the constant at first. After that, you can write the filter and you would be good to go.