wp_theme_update_row( string $theme_key, WP_Theme $theme ): void|false
- Since
- 3.1.0
- Source
wp-admin/includes/update.php:674
Compatibility
- WordPress
- since 3.1.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
$theme_keystring- Theme stylesheet.
$themeWP_Theme- Theme object.
Return value
void|false- Void on success, false if the theme update is not available.
Performance profile
How much work a call to wp_theme_update_row() 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
- 10–141
- Plugin surface
- 1 hook
- 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 340.
Third-party callbacks on 'in_theme_update_message-{$theme_key}' 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
- transienttransient
get_site_transient()called directly - hookthird-party callbacks
do_action()called directly - cacheobject cache
wp_cache_get()one call below wp_theme_update_row() - optionnetwork option
get_site_option()one call below wp_theme_update_row()
Further down the call graph this can also reach 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 · 14 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_theme_update_row() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($theme_key) | 10 | get_site_transient() |
isset($theme_key) | 76–81 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), do_action() |
isset($theme_key) && !current_user_can() | 87–93 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), do_action() |
isset($theme_key) && !current_user_can() | 94–99 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), current_user_can(), current_user_can(), do_action() |
isset($theme_key) | 98–103 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), current_user_can(), current_user_can(), current_user_can(), do_action() |
isset($theme_key) && current_user_can() | 99–104 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), __(), self_admin_url(), printf(), do_action() |
isset($theme_key) | 102–107 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), current_user_can(), __(), self_admin_url(), printf(), do_action() |
isset($theme_key) && current_user_can() | 105–110 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), __(), wp_get_update_php_url(), esc_url(), printf(), wp_update_php_annotation(), do_action() |
isset($theme_key) | 106–111 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), current_user_can(), current_user_can(), __(), self_admin_url(), printf(), do_action() |
isset($theme_key) | 110–115 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), current_user_can(), __(), esc_url(), __(), sprintf(), esc_attr(), printf(), do_action() |
isset($theme_key) | 112–117 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), current_user_can(), current_user_can(), __(), wp_get_update_php_url(), esc_url(), printf(), wp_update_php_annotation(), do_action() |
isset($theme_key) && current_user_can() | 112–117 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), current_user_can(), __(), self_admin_url(), wp_get_update_php_url(), esc_url(), printf(), wp_update_php_annotation(), do_action() |
2 further outcomes, up to 141 instructions
isset($theme_key) | 116–121 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), __(), printf(), current_user_can(), current_user_can(), current_user_can(), current_user_can(), __(), wp_get_update_php_url(), esc_url(), printf(), wp_update_php_annotation(), do_action() |
isset($theme_key) && current_user_can() && !empty($response) | 138–141 | get_site_transient(), add_query_arg(), _get_list_table(), ->is_allowed(), is_wp_version_compatible(), is_php_version_compatible(), ->get_stylesheet(), esc_attr(), ->get_stylesheet(), esc_attr(), ->get_column_count(), printf(), current_user_can(), __(), esc_url(), __(), sprintf(), esc_attr(), self_admin_url(), wp_nonce_url(), _x(), sprintf(), esc_attr(), printf(), do_action() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 343 | 10–144 | 18 | 3 more instructions than PHP 8.5 |
| 8.5 | 340 | 10–141 | 18 | |
| 8.4 | 340 | 10–141 | 18 | 4 fewer instructions than PHP 8.3 |
| 8.3 | 344 | 10–143 | 18 | |
| 8.2 | 344 | 10–143 | 18 | |
| 8.1 | 344 | 10–143 | 18 | |
| 7.4 | 344 | 10–143 | 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 · 1
One hook fires while wp_theme_update_row() runs, in this order:
- do_action( in_theme_update_message-{$theme_key} )actionline 837 (+163 into the body)
Fires at the end of the update message container in each row of the themes list table.
Uses · 15
- get_site_transient()Retrieves the value of a site transient.
- add_query_arg()Retrieves a modified URL query string.
- _get_list_table()Fetches an instance of a WP_List_Table class.
- is_wp_version_compatible()Checks compatibility with the current WordPress version.
- is_php_version_compatible()Checks compatibility with the current PHP version.
- esc_attr()Escaping for HTML attributes.
- current_user_can()Returns whether the current user has the specified capability.
- __()Retrieves the translation of $text.
- esc_url()Checks and cleans a URL.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- self_admin_url()Retrieves the URL to the admin area for either the current site or the network depending on context.
- _x()Retrieves translated string with gettext context.
Show all 15
- wp_get_update_php_url()Gets the URL to learn more about updating the PHP version the site is running on.
- wp_update_php_annotation()Prints the default annotation for the web host altering the "Update PHP" page URL.
- do_action()Calls the callback functions that have been added to an action hook.
Source code
function wp_theme_update_row( $theme_key, $theme ) { $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response[ $theme_key ] ) ) { return false; } $response = $current->response[ $theme_key ]; $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800, ), $current->response[ $theme_key ]['url'] ); /** @var WP_MS_Themes_List_Table $wp_list_table */ $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); $active = $theme->is_allowed( 'network' ) ? ' active' : ''; $requires_wp = $response['requires'] ?? null; $requires_php = $response['requires_php'] ?? null; $compatible_wp = is_wp_version_compatible( $requires_wp ); $compatible_php = is_php_version_compatible( $requires_php ); printf( '<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' . '<td colspan="%s" class="plugin-update colspanchange">' . '<div class="update-message notice inline notice-warning notice-alt"><p>', $active, esc_attr( $theme->get_stylesheet() . '-update' ), esc_attr( $theme->get_stylesheet() ), $wp_list_table->get_column_count() ); if ( $compatible_wp && $compatible_php ) { if ( ! current_user_can( 'update_themes' ) ) { printf( /* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */ __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', /* translators: 1: Theme name, 2: Version number. */ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'] ); } elseif ( empty( $response['package'] ) ) { printf( /* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */ __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', /* translators: 1: Theme name, 2: Version number. */ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'] ); } else { printf( /* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */ __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', /* translators: 1: Theme name, 2: Version number. */ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'], wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ), sprintf(Changelog
Introduced in 3.1.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/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.