The WordPress update system works locally using the same mechanism used to schedule posts and other tasks on the site, called wp-cron
.
Cron
is the name of the task scheduler built into Unix systems, and wp-cron
is a " adaptation "of the same functionality to run on systems that are not always running, such as a PHP site.
PHP only runs when the server receives a request, that is, in the case of WordPress, when a user accesses the site. What wp-cron
does is check, with each access, if there is a scheduled task to be fulfilled, and if yes, start this task. This check starts with an action linked to init
, triggered in the wp-includes/default-filters.php
file.
OneofthetasksincludedbydefaultistochecktwiceadaywhetherthereisanewversionofWordPresspostedonthecentralsite.Thischeckisdoneinthe wp_version_check()
function, which is in the wp-includes/update.php
file. This function makes a request POST
to http://api.wordpress.org/core/version-check/1.7/
sending details of your system, and this API responds with the newest version available for automatic updating (not all sites can be upgraded directly to the newer versions, so it checks the versions of your PHP, mySQL, etc, and then he checks to see which version is right for you.
Once this check is done, WordPress stores this information in transient
called update_core
.
From there, every time you access wp-admin
it checks whether the version stored in transient
is higher than the current version, and if you have automatic updates enabled, it already triggers the update. If not, it shows you the message asking to upgrade.