core_auto_updates_settings()
- Since
- 5.6.0
- Source
wp-admin/update-core.php:306
Compatibility
- WordPress
- since 5.6.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.
Performance profile
How much work a call to core_auto_updates_settings() 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
- Moderate
- Scaling
- Constant
- Instructions
- 77–157
- Plugin surface
- 4 hooks
- Called by
- 0
Reads stored settings via get_site_option(), cached per request but not free on a cold cache.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 204.
Third-party callbacks on 'allow_dev_auto_core_updates', 'allow_minor_auto_core_updates', 'allow_major_auto_core_updates' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- optionnetwork option
get_site_option()called directly - hookthird-party callbacks
apply_filters()called directly - transienttransient
get_site_transient()one call below core_auto_updates_settings()
Further down the call graph this can also reach cache, serialize and query. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 16 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost core_auto_updates_settings() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 77–108 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
!isset($value) | 86–117 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
isset($value) | 90–116 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
isset($value) && !version_compare() | 94–125 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
!->is_vcs_checkout() | 97–127 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
isset($value) && version_compare() | 99–130 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), wp_get_auto_update_message(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
| always | 99–125 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
!isset($value) && !->is_vcs_checkout() | 106–136 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
isset($value) && !version_compare() | 107–133 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
isset($value) && !->is_vcs_checkout() | 110–135 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
isset($value) && version_compare() | 112–138 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), wp_get_auto_update_message(), self_admin_url(), ->is_vcs_checkout(), _e(), do_action() |
isset($value) && !version_compare() && !->is_vcs_checkout() | 114–144 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
4 further outcomes, up to 157 instructions
isset($value) && version_compare() && !->is_vcs_checkout() | 119–149 | get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), wp_get_auto_update_message(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
!->is_vcs_checkout() | 119–144 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
isset($value) && !version_compare() && !->is_vcs_checkout() | 127–152 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
isset($value) && version_compare() && !->is_vcs_checkout() | 132–157 | __(), wp_admin_notice(), get_site_option(), get_site_option(), get_site_option(), ->is_disabled(), has_filter(), apply_filters(), apply_filters(), apply_filters(), wp_get_wp_version(), get_core_updates(), version_compare(), wp_get_auto_update_message(), self_admin_url(), ->is_vcs_checkout(), _e(), add_query_arg(), wp_nonce_url(), __(), printf(), do_action() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 212 | 77–161 | 18 | 8 more instructions than PHP 8.5 |
| 8.5 | 204 | 77–157 | 18 | |
| 8.4 | 204 | 77–157 | 18 | |
| 8.3 | 204 | 77–157 | 18 | |
| 8.2 | 204 | 77–157 | 18 | |
| 8.1 | 204 | 77–157 | 18 | |
| 7.4 | 204 | 77–157 | 18 |
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 · 4
4 hooks fire while core_auto_updates_settings() runs, in this order:
- apply_filters( allow_dev_auto_core_updates )filterline 383 (+77 into the body)
Filters whether to enable automatic core updates for development versions.
- apply_filters( allow_minor_auto_core_updates )filterline 385 (+79 into the body)
Filters whether to enable minor automatic core updates.
- apply_filters( allow_major_auto_core_updates )filterline 387 (+81 into the body)
Filters whether to enable major automatic core updates.
- do_action( after_core_auto_updates_settings )actionline 454 (+148 into the body)
Fires after the major core auto-update settings.
Uses · 14
- __()Retrieves the translation of $text.
- wp_admin_notice()Outputs an admin notice.
- get_site_option()Retrieve an option value for the current network based on name of option.
- has_filter()Checks if any filter has been registered for a hook.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wp_get_wp_version()Returns the current WordPress version.
- get_core_updates()Gets available core updates.
- wp_get_auto_update_message()Determines the appropriate auto-update message to be displayed.
- self_admin_url()Retrieves the URL to the admin area for either the current site or the network depending on context.
- _e()Displays translated text.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- add_query_arg()Retrieves a modified URL query string.
Show all 14
- do_action()Calls the callback functions that have been added to an action hook.
- WP_Automatic_Updater::__construct()
Source code
function core_auto_updates_settings() { if ( isset( $_GET['core-major-auto-updates-saved'] ) ) { if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) { $notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' ); wp_admin_notice( $notice_text, array( 'type' => 'success', 'dismissible' => true, ) ); } elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) { $notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' ); wp_admin_notice( $notice_text, array( 'type' => 'success', 'dismissible' => true, ) ); } } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $updater = new WP_Automatic_Updater(); // Defaults: $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; $can_set_update_option = true; // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'development', 'branch-development', 'minor', false. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { // Defaults to turned off, unless a filter allows it. $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { // ALL updates for core. $upgrade_dev = true; $upgrade_minor = true; $upgrade_major = true; } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { // Only minor updates for core. $upgrade_dev = false; $upgrade_minor = true; $upgrade_major = false; } // The UI is overridden by the `WP_AUTO_UPDATE_CORE` constant. $can_set_update_option = false; } if ( $updater->is_disabled() ) { $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; /* * The UI is overridden by the `AUTOMATIC_UPDATER_DISABLED` constant * or the `automatic_updater_disabled` filter, * or by `wp_is_file_mod_allowed( 'automatic_updater' )`. * See `WP_Automatic_Updater::is_disabled()`. */ $can_set_update_option = false; } // Is the UI overridden by a plugin using the `allow_major_auto_core_updates` filter? if ( has_filter( 'allow_major_auto_core_updates' ) ) { $can_set_update_option = false; } /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ $upgrade_dev = apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ); /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ $upgrade_minor = apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor );Changelog
Introduced in 5.6.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.1.0 tag, from
src/wp-admin/update-core.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.