WP_MS_Themes_List_Table::column_autoupdates( WP_Theme $theme )
- Since
- 5.5.0
- Source
wp-admin/includes/class-wp-ms-themes-list-table.php:806
Compatibility
- WordPress
- since 5.5.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
$themeWP_Theme- The current WP_Theme object.
Performance profile
How much work a call to WP_MS_Themes_List_Table::column_autoupdates() 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
- 53–92
- Plugin surface
- 1 hook
- Called by
- 1
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 121.
Third-party callbacks on 'theme_auto_update_setting_html' run inside this call, and their cost is not bounded by anything here.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- optionnetwork option
get_site_option()called directly - transienttransient
get_site_transient()called directly - hookthird-party callbacks
apply_filters()called directly - cacheobject cache
wp_cache_get()one call below WP_MS_Themes_List_Table::column_autoupdates()
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 · 32 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_MS_Themes_List_Table::column_autoupdates() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($theme) && empty($theme) && $action === "unavailable" && !isset($stylesheet) | 53 | ->get_stylesheet(), add_query_arg(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && !isset($stylesheet) | 56–59 | ->get_stylesheet(), __(), add_query_arg(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action === "unavailable" && !isset($stylesheet) | 57 | get_site_transient(), ->get_stylesheet(), add_query_arg(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action === "unavailable" && !isset($stylesheet) | 59 | get_site_option(), ->get_stylesheet(), add_query_arg(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && !isset($stylesheet) | 60–63 | get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action === "unavailable" && isset($stylesheet) | 62 | ->get_stylesheet(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && !isset($stylesheet) | 62–65 | get_site_option(), ->get_stylesheet(), __(), add_query_arg(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action === "unavailable" && !isset($stylesheet) | 63 | get_site_option(), get_site_transient(), ->get_stylesheet(), add_query_arg(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && isset($stylesheet) | 65–68 | ->get_stylesheet(), __(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action === "unavailable" && isset($stylesheet) | 66 | get_site_transient(), ->get_stylesheet(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && !isset($stylesheet) | 66–69 | get_site_option(), get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && !isset($stylesheet) | 67 | ->get_stylesheet(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
20 further outcomes, up to 92 instructions
!isset($theme) && empty($theme) && $action === "unavailable" && isset($stylesheet) | 68 | get_site_option(), ->get_stylesheet(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && isset($stylesheet) | 69–72 | get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && !isset($stylesheet) | 70–73 | ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && !isset($stylesheet) | 71 | get_site_transient(), ->get_stylesheet(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && isset($stylesheet) | 71–74 | get_site_option(), ->get_stylesheet(), __(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action === "unavailable" && isset($stylesheet) | 72 | get_site_option(), get_site_transient(), ->get_stylesheet(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && !isset($stylesheet) | 73 | get_site_option(), ->get_stylesheet(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && !isset($stylesheet) | 74–77 | get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
$action === "unavailable" && isset($stylesheet) | 75–78 | get_site_option(), get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && isset($stylesheet) | 76 | ->get_stylesheet(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && !isset($stylesheet) | 76–79 | get_site_option(), ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && !isset($stylesheet) | 77 | get_site_option(), get_site_transient(), ->get_stylesheet(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && isset($stylesheet) | 79–82 | ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && isset($stylesheet) | 80 | get_site_transient(), ->get_stylesheet(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && !isset($stylesheet) | 80–83 | get_site_option(), get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && isset($stylesheet) | 82 | get_site_option(), ->get_stylesheet(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && isset($stylesheet) | 83–86 | get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && isset($stylesheet) | 85–88 | get_site_option(), ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
!isset($theme) && empty($theme) && $action !== "unavailable" && isset($stylesheet) | 86 | get_site_option(), get_site_transient(), ->get_stylesheet(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
$action !== "unavailable" && isset($stylesheet) | 89–92 | get_site_option(), get_site_transient(), ->get_stylesheet(), __(), add_query_arg(), wp_nonce_url(), wp_get_auto_update_message(), apply_filters(), wp_admin_notice() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 121 | 53–92 | 8 | |
| 8.5 | 121 | 53–92 | 8 | |
| 8.4 | 121 | 53–92 | 8 | 6 fewer instructions than PHP 8.3 |
| 8.3 | 127 | 56–98 | 8 | |
| 8.2 | 127 | 56–98 | 8 | |
| 8.1 | 127 | 56–98 | 8 | |
| 7.4 | 127 | 56–98 | 8 |
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_MS_Themes_List_Table::column_autoupdates() runs, in this order:
- apply_filters( theme_auto_update_setting_html )filterline 887 (+81 into the body)
Filters the HTML of the auto-updates setting for each theme in the Themes list table.
Uses · 8
- get_site_option()Retrieve an option value for the current network based on name of option.
- get_site_transient()Retrieves the value of a site transient.
- __()Retrieves the translation of $text.
- add_query_arg()Retrieves a modified URL query string.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- wp_get_auto_update_message()Determines the appropriate auto-update message to be displayed.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wp_admin_notice()Outputs an admin notice.
Used by · 1
- WP_MS_Themes_List_Table::single_row_columns()Handles the output for a single table row.
Source code
public function column_autoupdates( $theme ) { global $status, $page; static $auto_updates, $available_updates; if ( ! $auto_updates ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); } if ( ! $available_updates ) { $available_updates = get_site_transient( 'update_themes' ); } $stylesheet = $theme->get_stylesheet(); if ( isset( $theme->auto_update_forced ) ) { if ( $theme->auto_update_forced ) { // Forced on. $text = __( 'Auto-updates enabled' ); } else { $text = __( 'Auto-updates disabled' ); } $action = 'unavailable'; $time_class = ' hidden'; } elseif ( empty( $theme->update_supported ) ) { $text = ''; $action = 'unavailable'; $time_class = ' hidden'; } elseif ( in_array( $stylesheet, $auto_updates, true ) ) { $text = __( 'Disable auto-updates' ); $action = 'disable'; $time_class = ''; } else { $text = __( 'Enable auto-updates' ); $action = 'enable'; $time_class = ' hidden'; } $query_args = array( 'action' => "{$action}-auto-update", 'theme' => $stylesheet, 'paged' => $page, 'theme_status' => $status, ); $url = add_query_arg( $query_args, 'themes.php' ); if ( 'unavailable' === $action ) { $html[] = '<span class="label">' . $text . '</span>'; } else { $html[] = sprintf( '<a href="%s" class="toggle-auto-update aria-button-if-js" data-wp-action="%s">', wp_nonce_url( $url, 'updates' ), $action ); $html[] = '<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span>'; $html[] = '<span class="label">' . $text . '</span>'; $html[] = '</a>'; } if ( isset( $available_updates->response[ $stylesheet ] ) ) { $html[] = sprintf( '<div class="auto-update-time%s">%s</div>', $time_class, wp_get_auto_update_message() ); } $html = implode( '', $html ); /** * Filters the HTML of the auto-updates setting for each theme in the Themes list table. * * @since 5.5.0 * * @param string $html The HTML for theme's auto-update setting, including * toggle auto-update action link and time to next update. * @param string $stylesheet Directory name of the theme. * @param WP_Theme $theme WP_Theme object.Changelog
Introduced in 5.5.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/class-wp-ms-themes-list-table.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.