wppaste
WordPress

core_auto_updates_settings()

Since
5.6.0
Source
wp-admin/update-core.php:306
Display WordPress auto-updates settings.

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

Reads stored settings via get_site_option(), cached per request but not free on a cold cache.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
77–157

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

Plugin surface
4 hooks

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.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • optionnetwork optionget_site_option()called directly
  • hookthird-party callbacksapply_filters()called directly
  • transienttransientget_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.

WhenInstructionsCalls it makes
always77–108get_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–117get_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–125get_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–127get_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–130get_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()
always99–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–136get_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–144get_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–149get_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

PHPCompiledExecutedBranchesNotes
8.6-dev21277–161188 more instructions than PHP 8.5
8.520477–15718
8.420477–15718
8.320477–15718
8.220477–15718
8.120477–15718
7.420477–15718

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:

  1. apply_filters( allow_dev_auto_core_updates )filterline 383 (+77 into the body)

    Filters whether to enable automatic core updates for development versions.

  2. apply_filters( allow_minor_auto_core_updates )filterline 385 (+79 into the body)

    Filters whether to enable minor automatic core updates.

  3. apply_filters( allow_major_auto_core_updates )filterline 387 (+81 into the body)

    Filters whether to enable major automatic core updates.

  4. do_action( after_core_auto_updates_settings )actionline 454 (+148 into the body)

    Fires after the major core auto-update settings.

Uses · 14

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.

  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 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.