wppaste
WordPress

list_theme_updates()

Since
2.9.0
Source
wp-admin/update-core.php:639
Display the upgrade themes form.

Compatibility

WordPress
since 2.9.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 list_theme_updates() 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
Heavy

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

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
18–79

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

Plugin surface
None

Nothing here hands control to plugin code.

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
  • transienttransientget_site_transient()one call below list_theme_updates()
  • hookthird-party callbacksapply_filters()one call below list_theme_updates()

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

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

WhenInstructionsCalls it makes
empty($themes)18get_theme_updates(), __(), __()
!empty($themes) && !wp_is_auto_update_enabled_for_type()69–70get_theme_updates(), __(), number_format_i18n(), printf(), _e(), __(), __(), printf(), esc_url(), wp_nonce_field(), esc_attr_e(), _e(), wp_is_auto_update_enabled_for_type(), _e(), esc_attr_e()
!empty($themes) && wp_is_auto_update_enabled_for_type()78–79get_theme_updates(), __(), number_format_i18n(), printf(), _e(), __(), __(), printf(), esc_url(), wp_nonce_field(), esc_attr_e(), _e(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_auto_update_message(), _e(), esc_attr_e()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev33318–80221 more instruction than PHP 8.5
8.533218–7922
8.433218–79223 fewer instructions than PHP 8.3
8.333518–7922
8.233518–7922
8.133518–79222 fewer instructions than PHP 7.4
7.433718–7922

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.

Uses · 17

Show all 17

Source code

function list_theme_updates() {	$themes = get_theme_updates();	if ( empty( $themes ) ) {		echo '<h2>' . __( 'Themes' ) . '</h2>';		echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';		return;	} 	$form_action = 'update-core.php?action=do-theme-upgrade'; 	$themes_count = count( $themes );	?><h2>	<?php	printf(		'%s <span class="count">(%d)</span>',		__( 'Themes' ),		number_format_i18n( $themes_count )	);	?></h2><p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p><p>	<?php	printf(		/* translators: %s: Link to documentation on child themes. */		__( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ),		__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )	);	?></p><form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">	<?php wp_nonce_field( 'upgrade-core' ); ?><p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p><table class="widefat updates-table" id="update-themes-table">	<thead>	<tr>		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>		<td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>	</tr>	</thead> 	<tbody class="plugins">	<?php	$auto_updates = array();	if ( wp_is_auto_update_enabled_for_type( 'theme' ) ) {		$auto_updates       = (array) get_site_option( 'auto_update_themes', array() );		$auto_update_notice = ' | ' . wp_get_auto_update_message();	} 	foreach ( $themes as $stylesheet => $theme ) {		$requires_wp  = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null;		$requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null; 		$compatible_wp  = is_wp_version_compatible( $requires_wp );		$compatible_php = is_php_version_compatible( $requires_php ); 		$compat = ''; 		if ( ! $compatible_wp && ! $compatible_php ) {			$compat .= '<br />' . __( 'This update does not work with your versions of WordPress and PHP.' ) . '&nbsp;';			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {				$compat .= sprintf(					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */					__( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),					esc_url( self_admin_url( 'update-core.php' ) ),					esc_url( wp_get_update_php_url() )				); 				$annotation = wp_get_update_php_annotation(); 				if ( $annotation ) {					$compat .= '</p><p><em>' . $annotation . '</em>';				}			} elseif ( current_user_can( 'update_core' ) ) {				$compat .= sprintf(					/* translators: %s: URL to WordPress Updates screen. */					__( '<a href="%s">Please update WordPress</a>.' ),					esc_url( self_admin_url( 'update-core.php' ) )				);

Changelog

Introduced in 2.9.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.9.7 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.