wp_update_themes( array $extra_stats = array() )
- Since
- 2.7.0
- Source
wp-includes/update.php:626
Description
Despite its name this function does not actually perform any updates, it only checks for available updates.
A list of all themes installed is sent to api.wordpress.org, along with the site locale.
Checks against the WordPress server at api.wordpress.org. Will only check if WordPress isn't installing.
Compatibility
- WordPress
- since 2.7.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$extra_statsarrayoptional- Extra statistics to report to the WordPress.org API.Default:
array()
Performance profile
How much work a call to wp_update_themes() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Expensive
- Scaling
- Scales with input
- Instructions
- 48–215
- Plugin surface
- 2 hooks
- Called by
- 4
Reaches an outbound HTTP request via wp_remote_post().
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 389.
Third-party callbacks on 'themes_update_check_locales', 'update_themes_{$hostname}' run inside this call, and their cost is not bounded by anything here.
4 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- transienttransient
get_site_transient()called directly - optionoption read or write
get_option()called directly - hookthird-party callbacks
apply_filters()called directly - httpoutbound HTTP request
wp_remote_post()called directly - serializeserialisation
json_decode()called directly - cacheobject cache
wp_cache_get()one call below wp_update_themes()
Further down the call graph this can also reach query. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 37 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_update_themes() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 48–54 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 111–128 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 115–132 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 116–133 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 116–133 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 117–134 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 120–137 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 120–137 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 121–138 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 121–138 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 122–139 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 122–139 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error() |
25 further outcomes, up to 215 instructions
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 125–142 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 126–143 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 126–143 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 127–144 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 131–148 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 141–168 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 145–172 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 145–164 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 146–173 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 147–174 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 150–177 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 150–169 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 150–169 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 151–178 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 151–170 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 152–179 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 155–174 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && !is_wp_error() | 156–183 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 156–175 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) && is_wp_error() | 156–175 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 161–180 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 175–204 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 180–209 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 181–210 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
!wp_installing() && is_object($last_update) && current_filter() && !isset($last_update) | 186–215 | wp_installing(), wp_get_themes(), wp_get_installed_translations(), get_site_transient(), get_option(), wp_doing_cron(), current_filter(), time(), set_site_transient(), get_available_languages(), array_values(), apply_filters(), array_unique(), wp_json_encode(), wp_json_encode(), wp_json_encode(), wp_get_wp_version(), home_url(), wp_json_encode(), wp_http_supports(), set_url_scheme(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), themes(), time(), wp_remote_retrieve_body(), json_decode(), set_site_transient() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 389 | 48–215 | 47 | |
| 8.5 | 389 | 48–215 | 47 | |
| 8.4 | 389 | 48–215 | 47 | |
| 8.3 | 389 | 48–215 | 47 | |
| 8.2 | 389 | 48–215 | 47 | 1 more instruction than PHP 8.1 |
| 8.1 | 388 | 48–215 | 47 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 389 | 48–215 | 47 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 2
2 hooks fire while wp_update_themes() runs, in this order:
- apply_filters( themes_update_check_locales )filterline 726 (+100 into the body)
Filters the locales requested for theme translations.
- apply_filters( update_themes_{$hostname} )filterline 833 (+207 into the body)
Filters the update response for a given theme hostname.
Uses · 24
- wp_installing()Checks or sets whether WordPress is in "installation" mode.
- wp_get_themes()Returns an array of WP_Theme objects based on the arguments.
- wp_get_installed_translations()Gets installed translations.
- get_site_transient()Retrieves the value of a site transient.
- get_option()Retrieves an option value based on an option name.
- wp_doing_cron()Determines whether the current request is a WordPress cron request.
- current_filter()Retrieves the name of the current filter hook.
- set_site_transient()Sets/updates the value of a site transient.
- get_available_languages()Gets all available languages based on the presence of *.mo and *.l10n.php files in a given directory.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wp_json_encode()Encodes a variable into JSON, with some confidence checks.
- wp_get_wp_version()Returns the current WordPress version.
Show all 24
- home_url()Retrieves the URL for the current site where the front end is accessible.
- wp_http_supports()Determines if there is an HTTP Transport that can process this request.
- set_url_scheme()Sets the scheme for a URL.
- wp_remote_post()Performs an HTTP request using the POST method and returns its response.
- is_wp_error()Checks whether the given variable is a WordPress Error.
- wp_trigger_error()Generates a user-level error/warning/notice/deprecation message.
- __()Retrieves the translation of $text.
- wp_remote_retrieve_response_code()Retrieves only the response code from the raw response.
- wp_remote_retrieve_body()Retrieves only the body from the raw response.
- wp_parse_url()A wrapper for PHP's parse_url() function that handles consistency in the return values across PHP versions.
- sanitize_url()Sanitizes a URL for database or redirect usage.
- stdClass::__construct()
Used by · 4
- WP_Automatic_Updater::run()Kicks off the background update process, looping through all pending updates.
- WP_Debug_Data::check_for_updates()Calls all core functions to check for updates.
- _maybe_update_themes()Checks themes versions only after a duration of time.
- wp_ajax_update_theme()Handles updating a theme via AJAX.
Source code
function wp_update_themes( $extra_stats = array() ) { if ( wp_installing() ) { return; } $installed_themes = wp_get_themes(); $translations = wp_get_installed_translations( 'themes' ); $last_update = get_site_transient( 'update_themes' ); if ( ! is_object( $last_update ) ) { $last_update = new stdClass(); } $themes = array(); $checked = array(); $request = array(); // Put slug of active theme into request. $request['active'] = get_option( 'stylesheet' ); foreach ( $installed_themes as $theme ) { $checked[ $theme->get_stylesheet() ] = $theme->get( 'Version' ); $themes[ $theme->get_stylesheet() ] = array( 'Name' => $theme->get( 'Name' ), 'Title' => $theme->get( 'Name' ), 'Version' => $theme->get( 'Version' ), 'Author' => $theme->get( 'Author' ), 'Author URI' => $theme->get( 'AuthorURI' ), 'UpdateURI' => $theme->get( 'UpdateURI' ), 'Template' => $theme->get_template(), 'Stylesheet' => $theme->get_stylesheet(), ); } $doing_cron = wp_doing_cron(); // Check for update on a different schedule, depending on the page. switch ( current_filter() ) { case 'upgrader_process_complete': $timeout = 0; break; case 'load-update-core.php': $timeout = MINUTE_IN_SECONDS; break; case 'load-themes.php': case 'load-update.php': $timeout = HOUR_IN_SECONDS; break; default: if ( $doing_cron ) { $timeout = 2 * HOUR_IN_SECONDS; } else { $timeout = 12 * HOUR_IN_SECONDS; } } $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked ); if ( $time_not_changed && ! $extra_stats ) { $theme_changed = false; foreach ( $checked as $slug => $v ) { if ( ! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v ) { $theme_changed = true; } } if ( isset( $last_update->response ) && is_array( $last_update->response ) ) { foreach ( $last_update->response as $slug => $update_details ) { if ( ! isset( $checked[ $slug ] ) ) { $theme_changed = true; break; } } } // Bail if we've checked recently and if nothing has changed. if ( ! $theme_changed ) {Changelog
Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/update.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.