wppaste
WordPress

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
Handles the name column output.

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

Reads stored settings via get_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
49–167

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

Plugin surface
2 hooks

Third-party callbacks on 'theme_action_links', 'theme_action_links_{$stylesheet}' run inside this call, and their cost is not bounded by anything here.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • optionoption read or writeget_option()called directly
  • hookthird-party callbacksapply_filters()called directly
  • cacheobject cachewp_cache_get()one call below WP_MS_Themes_List_Table::column_name()
  • serializeserialisationmaybe_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.

WhenInstructionsCalls 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 === false60–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()
always94–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 === false105–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 === false109–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 !== false109–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 !== false154–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 !== false158–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

PHPCompiledExecutedBranchesNotes
8.6-dev24849–166124 fewer instructions than PHP 8.5
8.525249–16712
8.425249–167123 more instructions than PHP 8.3
8.324949–16512
8.224949–16512
8.124949–16512
7.424949–16512

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:

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

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

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}&amp;";			$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' ) !== $stylesheet

Changelog

Introduced in 4.3.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/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.