Have you ever wondered how WordPress handles the automated core, plugin, and theme upgrades? Well, it’s time for some quick education!
WordPress is an Open Source project, which means there are hundreds of people all over the world working on it. (More than most commercial platforms.)
There are mainly 2 kinds of Automatic upgrades for WordPress:
- The main ‘Core’ upgrades
- The ‘Child’ upgrades, that works for themes and plugins that are being used in your WordPress.
We all see the plugin and theme installer while installing any theme or specific plugin required by the user, where it downloads the plugin to
/wp-content/upgrade/ , extracts the plugin, deletes the old one (if an old one exists), and copies the new one. It is used every time we install a theme or a plugin to the WordPress.
Since this is used more often than the core updater (most of the time as many different plugins are used), it’s the sort of upgrade we’re all used to and familiar with. And we think ‘WordPress deletes before upgrading, sure.’ This makes sense. After all, you want to make sure to clean out the old files, especially the ones that aren’t used anymore.
But that not how the WordPress Core updates work.
Core updates are available when there is a new version of WordPress is available with new features or some solved bugs.
Core updates are subdivided into three types:
- Core development updates, known as the “bleeding edge”
- Minor core updates, such as maintenance and security releases
- Major core release updates
By default, every site has automatic updates enabled for minor core releases and translation files. Sites already running a development version also have automatic updates to further development versions enabled by default.
The WordPress updates can be configured by 2 ways:
- defining constants in wp-config.php,
- or adding filters using a Plugin
Let’s discuss for both the methods.
Configuration via wp-config.php
We can configure the wp-config.php to, disable automatic updates, and the core updates can be disabled or configured based on update type.
To completely disable all types of automatic updates, core or otherwise, add the following to your wp-config.php file:
define( 'AUTOMATIC_UPDATER_DISABLED', true );
To enable automatic updates for major releases or development purposes, the place to start is with the WP_AUTO_UPDATE_CORE constant. Defining this constant one of three ways allows you to blanket-enable, or blanket-disable several types of core updates at once.
define( 'WP_AUTO_UPDATE_CORE', true );
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
Configuration via Filters using Plugins
Using filters allows for fine-tuned control of automatic updates.
The best place to put these filters is a must-use plugin.
Do not add add_filter() calls directly in wp-config.php. WordPress isn’t fully loaded and can cause conflicts with other applications such as WP-CLI.
We can also enable/disable all automatic updates by changing the values in the following filter:
add_filter( 'update_val', '__return_true' );
We can set the parameters
update_val as mentioned below:
- To disable the automatic updates we can set
- To enable the automatci updates we can set
update_valto different values as mentioned below:
auto_update_coreto enable all the updates
allow_dev_auto_core_updatesto enable the devlopement updates
allow_minor_auto_core_updatesto enable minor updates
allow_major_auto_core_updatesto enable the major updates
A Glimpse at Auto-Updates
WordPress has a magnificent auto-update system that notifies you when new versions of the WordPress core, installed plugins or themes are available. The notifications are displayed in the Admin Bar and also on the plugins page where you can get more details about the new version.
To install the new version, you simply hit the “Update automatically” button. WordPress will automatically download the new package, extract it and replace the old files. No FTP, removing old files, and uploading is required.
There is also a dedicated page for updates which can be reached from the dashboard menu. It’s helpful when you want to do bulk updates of multiple plugins instead of updating each one separately. It also has a “Check Again” button which checks for new updates. By default, WordPress does this check every 12 hours.
In the later weeks, we will be applying this WordPress like update system to Engelsystem. Developers who are interested to contribute can work with us.