WP_Themes_List_Table::display_rows()
- Since
- 3.1.0
- Source
wp-admin/includes/class-wp-themes-list-table.php:196
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.
Performance profile
How much work a call to WP_Themes_List_Table::display_rows() 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
- Light
- Scaling
- Scales with input
- Instructions
- 4–5
- Plugin surface
- 2 hooks
- Called by
- 1
Touches nothing outside its own arguments.
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 240.
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
- hookthird-party callbacks
apply_filters()called directly
Further down the call graph this can also reach option, transient, cache, 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 · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Themes_List_Table::display_rows() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 4–5 | none |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 240 | 4–5 | 12 | |
| 8.5 | 240 | 4–5 | 12 | |
| 8.4 | 240 | 4–5 | 12 | 2 more instructions than PHP 8.3 |
| 8.3 | 238 | 4–5 | 12 | |
| 8.2 | 238 | 4–5 | 12 | |
| 8.1 | 238 | 4–5 | 12 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 239 | 4–5 | 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_Themes_List_Table::display_rows() runs, in this order:
- apply_filters( theme_action_links )filterline 240 (+44 into the body)
Filters the action links displayed for each theme in the Multisite themes list table.
- apply_filters( theme_action_links_{$stylesheet} )filterline 243 (+47 into the body)
Filters the action links of a specific theme in the Multisite themes list table.
Uses · 12
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- esc_attr()Escaping for HTML attributes.
- _x()Retrieves translated string with gettext context.
- current_user_can()Returns whether the current user has the specified capability.
- wp_customize_url()Returns a URL to load the Customizer.
- __()Retrieves the translation of $text.
- is_multisite()Determines whether Multisite is enabled.
- esc_js()Escapes single quotes, `"`, ``, `&`, and fixes line endings.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- esc_url()Checks and cleans a URL.
- _e()Displays translated text.
- theme_update_available()Check if there is an update for a theme available.
Used by · 1
Source code
public function display_rows() { $themes = $this->items; foreach ( $themes as $theme ) : ?> <div class="available-theme"> <?php $template = $theme->get_template(); $stylesheet = $theme->get_stylesheet(); $title = $theme->display( 'Name' ); $version = $theme->display( 'Version' ); $author = $theme->display( 'Author' ); $activate_link = wp_nonce_url( 'themes.php?action=activate&template=' . urlencode( $template ) . '&stylesheet=' . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet ); $actions = array(); $actions['activate'] = sprintf( '<a href="%s" class="activatelink" title="%s">%s</a>', $activate_link, /* translators: %s: Theme name. */ esc_attr( sprintf( _x( 'Activate “%s”', 'theme' ), $title ) ), _x( 'Activate', 'theme' ) ); if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $actions['preview'] .= sprintf( '<a href="%s" class="load-customize hide-if-no-customize">%s</a>', wp_customize_url( $stylesheet ), __( 'Live Preview' ) ); } if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) { $actions['delete'] = sprintf( '<a class="submitdelete deletion" href="%s" onclick="return confirm( \'%s\' );">%s</a>', wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet ), /* translators: %s: Theme name. */ esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $title ) ), __( 'Delete' ) ); } /** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */ $actions = apply_filters( 'theme_action_links', $actions, $theme, 'all' ); /** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */ $actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, 'all' ); $delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : ''; unset( $actions['delete'] ); $screenshot = $theme->get_screenshot(); ?> <span class="screenshot hide-if-customize"> <?php if ( $screenshot ) : ?> <img src="<?php echo esc_url( $screenshot . '?ver=' . $theme->version ); ?>" alt="" /> <?php endif; ?> </span> <a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize"> <?php if ( $screenshot ) : ?> <img src="<?php echo esc_url( $screenshot . '?ver=' . $theme->version ); ?>" alt="" /> <?php endif; ?> </a> <h3><?php echo $title; ?></h3> <div class="theme-author"> <?php /* translators: %s: Theme author. */ printf( __( 'By %s' ), $author ); ?> </div> <div class="action-links"> <ul> <?php foreach ( $actions as $action ) : ?> <li><?php echo $action; ?></li> <?php endforeach; ?> <li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e( 'Details' ); ?></a></li> </ul> <?php echo $delete_action; ?>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 6.7.7 tag, from
src/wp-admin/includes/class-wp-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.