Update Functions
Source: wp-includes/update.php
Core Update Functions
wp_version_check()
Checks WordPress version against the newest version available on WordPress.org.
wp_version_check( array $extra_stats = array(), bool $force_check = false )
Parameters:
$extra_stats(array) – Extra statistics to report to the WordPress.org API$force_check(bool) – Bypass transient cache and force fresh check. Auto-true if$extra_statsprovided.
Returns: void
Behavior:
- Bails if
wp_installing()returns true - Respects 1-minute rate limit between checks (unless forced)
- Collects system info: WP version, PHP, MySQL, locale, extensions, image support
- POSTs to
api.wordpress.org/core/version-check/1.7/ - Stores result in
update_coresite transient - May trigger
wp_maybe_auto_updateaction if running via cron
Since: 2.3.0
wp_update_plugins()
Checks for available plugin updates from WordPress.org.
wp_update_plugins( array $extra_stats = array() )
Parameters:
$extra_stats(array) – Extra statistics to report to the API
Returns: void
Behavior:
- Loads
wp-admin/includes/plugin.phpif needed forget_plugins() - Compiles list of all plugins with versions
- POSTs to
api.wordpress.org/plugins/update-check/1.1/ - Processes third-party updates via
Update URIheader - Stores in
update_pluginssite transient with structure:response– Plugins with updates availableno_update– Plugins at latest versionchecked– All plugins and their versionstranslations– Available translation updates
Since: 2.3.0
wp_update_themes()
Checks for available theme updates from WordPress.org.
wp_update_themes( array $extra_stats = array() )
Parameters:
$extra_stats(array) – Extra statistics to report to the API
Returns: void
Behavior:
- Collects all themes via
wp_get_themes() - POSTs to
api.wordpress.org/themes/update-check/1.1/ - Processes third-party updates via
Update URIheader - Stores in
update_themessite transient
Since: 2.7.0
Auto-Update Functions
wp_maybe_auto_update()
Performs WordPress automatic background updates for core, plugins, and themes.
wp_maybe_auto_update()
Returns: void
Behavior:
- Requires
wp-admin/includes/admin.phpandclass-wp-upgrader.php - Instantiates
WP_Automatic_Updater - Calls
$upgrader->run()
Since: 3.7.0
Translation Functions
wp_get_translation_updates()
Retrieves all available translation updates across core, plugins, and themes.
wp_get_translation_updates(): object[]
Returns: Array of translation objects with available updates
Behavior:
- Reads
update_core,update_plugins,update_themestransients - Extracts
translationsarray from each - Returns combined list of translation update objects
Since: 3.7.0
UI Helper Functions
wp_get_update_data()
Collects counts and UI strings for available updates (used in admin menu badges).
wp_get_update_data(): array
Returns:
array(
'counts' => array(
'plugins' => int,
'themes' => int,
'wordpress' => int, // 0 or 1
'translations' => int, // 0 or 1
'total' => int,
),
'title' => string, // e.g., "5 Plugin Updates, 2 Theme Updates"
)
Behavior:
- Respects user capabilities (
update_plugins,update_themes,update_core) - Only counts non-dismissed core updates
- Generates human-readable title string
Since: 3.3.0
Internal/Private Functions
_maybe_update_core()
Conditionally triggers core version check if stale (>12 hours).
_maybe_update_core()
Hooked to: admin_init
Since: 2.8.0
_maybe_update_plugins()
Conditionally triggers plugin version check if stale (>12 hours).
_maybe_update_plugins()
Hooked to: admin_init
Since: 2.7.0
Access: Private
_maybe_update_themes()
Conditionally triggers theme version check if stale (>12 hours).
_maybe_update_themes()
Hooked to: admin_init
Since: 2.7.0
Access: Private
Scheduling Functions
wp_schedule_update_checks()
Schedules twice-daily cron events for update checks.
wp_schedule_update_checks()
Behavior:
- Schedules
wp_version_checkevent - Schedules
wp_update_pluginsevent - Schedules
wp_update_themesevent - All use
twicedailyrecurrence
Hooked to: init
Since: 3.1.0
Cache Functions
wp_clean_update_cache()
Clears all update transient caches.
wp_clean_update_cache()
Behavior:
- Calls
wp_clean_plugins_cache()if available, else deletesupdate_pluginstransient - Calls
wp_clean_themes_cache() - Deletes
update_coretransient
Hooked to: update_option_WPLANG
Since: 4.1.0
Backup Cleanup Functions
wp_delete_all_temp_backups()
Schedules removal of temporary backup directory contents.
wp_delete_all_temp_backups()
Behavior:
- Checks for update locks (
core_updater.lock,auto_updater.lock) - If locked or doing Ajax, reschedules for 1 hour later
- Otherwise hooks
_wp_delete_all_temp_backups()toshutdown
Hooked to: wp_delete_temp_updater_backups cron event
Since: 6.3.0
_wp_delete_all_temp_backups()
Actually deletes contents of wp-content/upgrade-temp-backup/.
_wp_delete_all_temp_backups()
Behavior:
- Requires filesystem credentials
- Iterates
upgrade-temp-backup/directory - Recursively deletes all subdirectories
Since: 6.3.0
Access: Private
Transient Data Structures
update_core
object(
'updates' => array( /* offer objects */ ),
'last_checked' => int, // Unix timestamp
'version_checked' => string,
'translations' => array( /* translation objects */ ),
)
update_plugins
object(
'last_checked' => int,
'checked' => array( 'plugin/file.php' => 'version' ),
'response' => array( 'plugin/file.php' => object ),
'no_update' => array( 'plugin/file.php' => object ),
'translations' => array( /* translation objects */ ),
)
update_themes
object(
'last_checked' => int,
'checked' => array( 'theme-slug' => 'version' ),
'response' => array( 'theme-slug' => array ),
'no_update' => array( 'theme-slug' => array ),
'translations' => array( /* translation objects */ ),
)