WP_MS_Themes_List_Table::column_name( WP_Theme $theme )
- Since
- 4.3.0
- Source
wp-admin/includes/class-wp-ms-themes-list-table.php:562
Compatibility
- WordPress
- since 4.3.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_name() 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
- 49–167
- Plugin surface
- 2 hooks
- Called by
- 1
Reads stored settings via get_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 252.
Third-party callbacks on 'theme_action_links', 'theme_action_links_{$stylesheet}' 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
- optionoption read or write
get_option()called directly - hookthird-party callbacks
apply_filters()called directly - cacheobject cache
wp_cache_get()one call below WP_MS_Themes_List_Table::column_name() - serializeserialisation
maybe_unserialize()one call below WP_MS_Themes_List_Table::column_name()
Further down the call graph this can also reach query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 15 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_name() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
->errors() | 49–58 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
->errors() && !current_user_can() | 55–62 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), current_user_can(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
->errors() && current_user_can() && $stylesheet === false | 60–67 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), current_user_can(), get_option(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
->errors() && current_user_can() | 65–72 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), current_user_can(), get_option(), get_option(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
| always | 94–105 | ->is_allowed(), ->get_stylesheet(), urlencode(), disable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
!->errors() | 98–109 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), enable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
!current_user_can() | 100–109 | ->is_allowed(), ->get_stylesheet(), urlencode(), disable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
!->errors() && !current_user_can() | 104–113 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), enable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
current_user_can() && $stylesheet === false | 105–114 | ->is_allowed(), ->get_stylesheet(), urlencode(), disable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), get_option(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
!->errors() && current_user_can() && $stylesheet === false | 109–118 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), enable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), get_option(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
->errors() && current_user_can() && $stylesheet !== false | 109–116 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), current_user_can(), get_option(), get_option(), delete-selected(), _x(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
current_user_can() | 110–119 | ->is_allowed(), ->get_stylesheet(), urlencode(), disable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), get_option(), get_option(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
3 further outcomes, up to 167 instructions
!->errors() && current_user_can() | 114–123 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), enable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), get_option(), get_option(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
current_user_can() && $stylesheet !== false | 154–163 | ->is_allowed(), ->get_stylesheet(), urlencode(), disable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), get_option(), get_option(), delete-selected(), _x(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
!->errors() && current_user_can() && $stylesheet !== false | 158–167 | ->is_allowed(), ->get_stylesheet(), urlencode(), ->errors(), enable(), __(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), current_user_can(), get_option(), get_option(), delete-selected(), _x(), ->display(), sprintf(), wp_nonce_url(), esc_url(), esc_attr(), __(), array_filter(), apply_filters(), apply_filters(), ->row_actions() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 248 | 49–166 | 12 | 4 fewer instructions than PHP 8.5 |
| 8.5 | 252 | 49–167 | 12 | |
| 8.4 | 252 | 49–167 | 12 | 3 more instructions than PHP 8.3 |
| 8.3 | 249 | 49–165 | 12 | |
| 8.2 | 249 | 49–165 | 12 | |
| 8.1 | 249 | 49–165 | 12 | |
| 7.4 | 249 | 49–165 | 12 |
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 · 2
2 hooks fire while WP_MS_Themes_List_Table::column_name() runs, in this order:
- apply_filters( theme_action_links )filterline 687 (+125 into the body)
Filters the action links displayed for each theme in the Multisite themes list table.
- apply_filters( theme_action_links_{$stylesheet} )filterline 703 (+141 into the body)
Filters the action links of a specific theme in the Multisite themes list table.
Uses · 10
- add_query_arg()Retrieves a modified URL query string.
- __()Retrieves the translation of $text.
- esc_url()Checks and cleans a URL.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- esc_attr()Escaping for HTML attributes.
- current_user_can()Returns whether the current user has the specified capability.
- get_option()Retrieves an option value based on an option name.
- _x()Retrieves translated string with gettext context.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- WP_MS_Themes_List_Table::row_actions()
Used by · 1
- WP_MS_Themes_List_Table::single_row_columns()Handles the output for a single table row.
Source code
public function column_name( $theme ) { global $status, $page, $s; $context = $status; if ( $this->is_site_themes ) { $url = "site-themes.php?id={$this->site_id}&"; $allowed = $theme->is_allowed( 'site', $this->site_id ); } else { $url = 'themes.php?'; $allowed = $theme->is_allowed( 'network' ); } // Pre-order. $actions = array( 'enable' => '', 'disable' => '', 'delete' => '', ); $stylesheet = $theme->get_stylesheet(); $theme_key = urlencode( $stylesheet ); if ( ! $allowed ) { if ( ! $theme->errors() ) { $url = add_query_arg( array( 'action' => 'enable', 'theme' => $theme_key, 'paged' => $page, 's' => $s, ), $url ); if ( $this->is_site_themes ) { /* translators: %s: Theme name. */ $aria_label = sprintf( __( 'Enable %s' ), $theme->display( 'Name' ) ); } else { /* translators: %s: Theme name. */ $aria_label = sprintf( __( 'Network Enable %s' ), $theme->display( 'Name' ) ); } $actions['enable'] = sprintf( '<a href="%s" class="edit" aria-label="%s">%s</a>', esc_url( wp_nonce_url( $url, 'enable-theme_' . $stylesheet ) ), esc_attr( $aria_label ), ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) ); } } else { $url = add_query_arg( array( 'action' => 'disable', 'theme' => $theme_key, 'paged' => $page, 's' => $s, ), $url ); if ( $this->is_site_themes ) { /* translators: %s: Theme name. */ $aria_label = sprintf( __( 'Disable %s' ), $theme->display( 'Name' ) ); } else { /* translators: %s: Theme name. */ $aria_label = sprintf( __( 'Network Disable %s' ), $theme->display( 'Name' ) ); } $actions['disable'] = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( wp_nonce_url( $url, 'disable-theme_' . $stylesheet ) ), esc_attr( $aria_label ), ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) ); } if ( ! $allowed && ! $this->is_site_themes && current_user_can( 'delete_themes' ) && get_option( 'stylesheet' ) !== $stylesheetChangelog
Introduced in 4.3.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.0.4 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.