wppaste
WordPress

wp_version_check( array $extra_stats = array(), bool $force_check = false )

Since
2.3.0
Source
wp-includes/update.php:32
Checks WordPress version against the newest version.

Description

The WordPress version, PHP version, and locale is sent to api.wordpress.org.

Checks against the WordPress server at api.wordpress.org. Will only check if WordPress isn't installing.

Compatibility

WordPress
since 2.3.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()
$force_checkbooloptional
Whether to bypass the transient cache and force a fresh update check.
Defaults to false, true if $extra_stats is set.Default: false

Performance profile

How much work a call to wp_version_check() 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

Reaches an outbound HTTP request via wp_remote_post().

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
164–272

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 437.

Plugin surface
3 hooks

Third-party callbacks on 'core_version_check_locale', 'core_version_check_query_args', 'wp_maybe_auto_update' run inside this call, and their cost is not bounded by anything here.

Called by
5

5 places in core call this, so the cost is paid more often than your own code shows.

What it touches

  • transienttransientget_site_transient()called directly
  • hookthird-party callbacksapply_filters()called directly
  • optionnetwork optionget_site_option()called directly
  • httpoutbound HTTP requestwp_remote_post()called directly
  • serializeserialisationjson_decode()called directly
  • cacheobject cachewp_cache_get()one call below wp_version_check()

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 · 36 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_version_check() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_wp_error()164–165wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE')168–169wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error()169–170wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error()173–174wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error()180–183wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error()184–187wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_wp_error()198–201wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE')203–205wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), 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() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body)207–215wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && doing_action()211–219wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body)211–219wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !doing_action()214–222wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), doing_action(), do_action()
24 further outcomes, up to 272 instructions
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE')214–218wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && doing_action()215–223wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body)218–223wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !doing_action()218–226wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), doing_action(), do_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && doing_action()222–227wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body)222–227wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && !doing_action()225–230wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), doing_action(), do_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body)225–230wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && doing_action()226–231wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && doing_action()229–234wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && !doing_action()229–234wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), doing_action(), do_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body)229–234wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && !doing_action()232–237wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event(), doing_action(), do_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && doing_action()233–238wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && !is_wp_error() && is_array($body) && isset($body) && !empty($body) && !doing_action()236–241wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event(), doing_action(), do_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body)241–250wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && doing_action()245–254wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && !doing_action()248–257wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), doing_action(), do_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && !empty($body)252–258wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && !empty($body) && doing_action()256–262wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && !empty($body) && !doing_action()259–265wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), doing_action(), do_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && !empty($body)259–265wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && !empty($body) && doing_action()263–269wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event(), doing_action()
!wp_installing() && empty($extra_stats) && !isset($current) && !method_exists() && !is_multisite() && !isset($wp_local_package) && !function_exists() && !is_array($extra_stats) && !defined('WP_AUTO_UPDATE_CORE') && is_array($body) && isset($body) && !empty($body) && !doing_action()266–272wp_installing(), get_site_transient(), wp_get_installed_translations(), get_locale(), apply_filters(), time(), set_site_transient(), method_exists(), method_exists(), is_multisite(), home_url(), get_loaded_extensions(), sort(), wp_get_wp_version(), get_user_count(), get_site_option(), array_map(), array_combine(), function_exists(), apply_filters(), wp_json_encode(), http_build_query(), wp_http_supports(), wp_doing_cron(), wp_get_wp_version(), home_url(), home_url(), wp_remote_post(), is_wp_error(), __(), __(), sprintf(), __(), headers_sent(), wp_trigger_error(), wp_remote_post(), is_wp_error(), wp_remote_retrieve_response_code(), wp_remote_retrieve_body(), json_decode(), wp_install(), time(), wp_get_wp_version(), set_site_transient(), time(), wp_next_scheduled(), time(), wp_schedule_single_event(), doing_action(), do_action()

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

PHPCompiledExecutedBranchesNotes
8.6-dev437164–27239
8.5437164–27239
8.4437164–272399 fewer instructions than PHP 8.3
8.3446166–27739
8.2446166–27739
8.1446166–27739
7.4446166–27739

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 · 3

3 hooks fire while wp_version_check() runs, in this order:

  1. apply_filters( core_version_check_locale )filterline 74 (+42 into the body)

    Filters the locale requested for WordPress core translations.

  2. apply_filters( core_version_check_query_args )filterline 176 (+144 into the body)

    Filters the query arguments sent as part of the core version check.

  3. do_action( wp_maybe_auto_update )actionline 304 (+272 into the body)

    Fires during wp_cron, starting the auto-update process.

Uses · 31

Show all 31

Used by · 5

Source code

function wp_version_check( $extra_stats = array(), $force_check = false ) {	global $wpdb, $wp_local_package; 	if ( wp_installing() ) {		return;	} 	$php_version = PHP_VERSION; 	$current      = get_site_transient( 'update_core' );	$translations = wp_get_installed_translations( 'core' ); 	// Invalidate the transient when $wp_version changes.	if ( is_object( $current ) && wp_get_wp_version() !== $current->version_checked ) {		$current = false;	} 	if ( ! is_object( $current ) ) {		$current                  = new stdClass();		$current->updates         = array();		$current->version_checked = wp_get_wp_version();	} 	if ( ! empty( $extra_stats ) ) {		$force_check = true;	} 	// Wait 1 minute between multiple version check requests.	$timeout          = MINUTE_IN_SECONDS;	$time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); 	if ( ! $force_check && $time_not_changed ) {		return;	} 	/**	 * Filters the locale requested for WordPress core translations.	 *	 * @since 2.8.0	 *	 * @param string $locale Current locale.	 */	$locale = apply_filters( 'core_version_check_locale', get_locale() ); 	// Update last_checked for current to prevent multiple blocking requests if request hangs.	$current->last_checked = time();	set_site_transient( 'update_core', $current ); 	if ( method_exists( $wpdb, 'db_server_info' ) ) {		$mysql_version = $wpdb->db_server_info();	} elseif ( method_exists( $wpdb, 'db_version' ) ) {		$mysql_version = preg_replace( '/[^0-9.].*/', '', $wpdb->db_version() );	} else {		$mysql_version = 'N/A';	} 	if ( is_multisite() ) {		$num_blogs         = get_blog_count();		$wp_install        = network_site_url();		$multisite_enabled = 1;	} else {		$multisite_enabled = 0;		$num_blogs         = 1;		$wp_install        = home_url( '/' );	} 	$extensions = get_loaded_extensions();	sort( $extensions, SORT_STRING | SORT_FLAG_CASE );	$query = array(		'version'            => wp_get_wp_version(),		'php'                => $php_version,		'locale'             => $locale,		'mysql'              => $mysql_version,		'local_package'      => isset( $wp_local_package ) ? $wp_local_package : '',		'blogs'              => $num_blogs,		'users'              => get_user_count(),		'multisite_enabled'  => $multisite_enabled,		'initial_db_version' => get_site_option( 'initial_db_version' ),		'extensions'         => array_combine( $extensions, array_map( 'phpversion', $extensions ) ),		'platform_flags'     => array(

Changelog

Introduced in 2.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 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.