wppaste
WordPress

WP_MS_Themes_List_Table::single_row( WP_Theme $theme )

Source
wp-admin/includes/class-wp-ms-themes-list-table.php:1010
Handles the output for a single table row.

Compatibility

WordPress
core
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::single_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
Trivial

Touches nothing outside its own arguments.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
48–61

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

Plugin surface
2 hooks

Third-party callbacks on 'after_theme_row', 'after_theme_row_{$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

  • hookthird-party callbacksdo_action()called directly

Further down the call graph this can also reach option, cache, serialize, 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 · 2 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::single_row() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always48–56->is_allowed(), ->get_stylesheet(), esc_attr(), esc_attr(), printf(), ->single_row_columns(), do_action(), do_action()
always53–61->is_allowed(), ->get_stylesheet(), esc_attr(), esc_attr(), printf(), ->single_row_columns(), remove_action(), do_action(), do_action()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev6749–6251 more instruction than PHP 8.5
8.56648–615
8.46648–615
8.36648–615
8.26648–615
8.16648–615
7.46648–615

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::single_row() runs, in this order:

  1. do_action( after_theme_row )actionline 1049 (+39 into the body)

    Fires after each row in the Multisite themes list table.

  2. do_action( after_theme_row_{$stylesheet} )actionline 1064 (+54 into the body)

    Fires after each specific row in the Multisite themes list table.

Uses · 4

Used by · 1

Source code

	public function single_row( $theme ) {		global $status, $totals; 		if ( $this->is_site_themes ) {			$allowed = $theme->is_allowed( 'site', $this->site_id );		} else {			$allowed = $theme->is_allowed( 'network' );		} 		$stylesheet = $theme->get_stylesheet(); 		$class = ! $allowed ? 'inactive' : 'active';		if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) ) {			$class .= ' update';		} 		printf(			'<tr class="%s" data-slug="%s">',			esc_attr( $class ),			esc_attr( $stylesheet )		); 		$this->single_row_columns( $theme ); 		echo '</tr>'; 		if ( $this->is_site_themes ) {			remove_action( "after_theme_row_$stylesheet", 'wp_theme_update_row' );		} 		/**		 * Fires after each row in the Multisite themes list table.		 *		 * @since 3.1.0		 *		 * @param string   $stylesheet Directory name of the theme.		 * @param WP_Theme $theme      Current WP_Theme object.		 * @param string   $status     Status of the theme.		 */		do_action( 'after_theme_row', $stylesheet, $theme, $status ); 		/**		 * Fires after each specific row in the Multisite themes list table.		 *		 * The dynamic portion of the hook name, `$stylesheet`, refers to the		 * directory name of the theme, most often synonymous with the template		 * name of the theme.		 *		 * @since 3.5.0		 *		 * @param string   $stylesheet Directory name of the theme.		 * @param WP_Theme $theme      Current WP_Theme object.		 * @param string   $status     Status of the theme.		 */		do_action( "after_theme_row_{$stylesheet}", $stylesheet, $theme, $status );	}

Changelog

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