WP_Theme_Install_List_Table::install_theme_info( stdClass $theme )
- Source
wp-admin/includes/class-wp-theme-install-list-table.php:441
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
$themestdClass- A WordPress.org Theme API object.
Performance profile
How much work a call to WP_Theme_Install_List_Table::install_theme_info() 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
- Scaling
- Constant
- Instructions
- 5–139
- Plugin surface
- None
- Called by
- 2
Touches nothing outside its own arguments.
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 172.
Nothing here hands control to plugin code.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()one call below WP_Theme_Install_List_Table::install_theme_info()
Further down the call graph this can also reach option, cache, serialize, transient 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 · 7 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Theme_Install_List_Table::install_theme_info() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
empty($theme) | 5 | none |
!empty($theme) && !isset($theme) | 106–112 | wp_kses(), wp_kses(), self_admin_url(), install-theme(), self_admin_url(), upgrade-theme(), ->_get_theme_status(), _x(), printf(), __(), printf(), rating(), _e(), wp_kses(), wp_kses(), esc_url() |
!empty($theme) && !isset($theme) | 114–122 | wp_kses(), wp_kses(), self_admin_url(), install-theme(), self_admin_url(), upgrade-theme(), ->_get_theme_status(), wp_nonce_url(), esc_url(), __(), printf(), __(), printf(), rating(), _e(), wp_kses(), wp_kses(), esc_url() |
!empty($theme) && isset($theme) | 116–122 | wp_kses(), wp_kses(), self_admin_url(), install-theme(), self_admin_url(), upgrade-theme(), ->_get_theme_status(), _x(), printf(), __(), printf(), esc_url(), rating(), _e(), wp_kses(), wp_kses(), esc_url() |
!empty($theme) && isset($theme) | 124–132 | wp_kses(), wp_kses(), self_admin_url(), install-theme(), self_admin_url(), upgrade-theme(), ->_get_theme_status(), wp_nonce_url(), esc_url(), __(), printf(), __(), printf(), esc_url(), rating(), _e(), wp_kses(), wp_kses(), esc_url() |
!empty($theme) && !isset($theme) | 127–129 | wp_kses(), wp_kses(), self_admin_url(), install-theme(), self_admin_url(), upgrade-theme(), ->_get_theme_status(), wp_nonce_url(), esc_url(), __(), sprintf(), esc_attr(), __(), printf(), __(), printf(), rating(), _e(), wp_kses(), wp_kses(), esc_url() |
!empty($theme) && isset($theme) | 137–139 | wp_kses(), wp_kses(), self_admin_url(), install-theme(), self_admin_url(), upgrade-theme(), ->_get_theme_status(), wp_nonce_url(), esc_url(), __(), sprintf(), esc_attr(), __(), printf(), __(), printf(), esc_url(), rating(), _e(), wp_kses(), wp_kses(), esc_url() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 175 | 5–141 | 6 | 3 more instructions than PHP 8.5 |
| 8.5 | 172 | 5–139 | 6 | |
| 8.4 | 172 | 5–139 | 6 | |
| 8.3 | 172 | 5–139 | 6 | |
| 8.2 | 172 | 5–139 | 6 | |
| 8.1 | 172 | 5–139 | 6 | |
| 7.4 | 172 | 5–139 | 6 |
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.
Uses · 11
- wp_kses()Filters text content and strips out disallowed HTML.
- add_query_arg()Retrieves a modified URL query string.
- self_admin_url()Retrieves the URL to the admin area for either the current site or the network depending on context.
- esc_url()Checks and cleans a URL.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- esc_attr()Escaping for HTML attributes.
- __()Retrieves the translation of $text.
- _x()Retrieves translated string with gettext context.
- wp_star_rating()Outputs a HTML element with a star rating for a given rating.
- _e()Displays translated text.
- WP_Theme_Install_List_Table::_get_theme_status()Checks to see if the theme is already installed.
Used by · 2
- WP_Theme_Install_List_Table::single_row()Prints a theme from the WordPress.org API.
- WP_Theme_Install_List_Table::theme_installer_single()Prints the wrapper for the theme installer with a provided theme's data.
Source code
public function install_theme_info( $theme ) { global $themes_allowedtags; if ( empty( $theme ) ) { return; } $name = wp_kses( $theme->name, $themes_allowedtags ); $author = wp_kses( $theme->author, $themes_allowedtags ); $install_url = add_query_arg( array( 'action' => 'install-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $update_url = add_query_arg( array( 'action' => 'upgrade-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $status = $this->_get_theme_status( $theme ); ?> <div class="install-theme-info"> <?php switch ( $status ) { case 'update_available': printf( '<a class="theme-install button button-primary" href="%s" aria-label="%s">%s</a>', esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), /* translators: %s: Theme version. */ esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), __( 'Update' ) ); break; case 'newer_installed': case 'latest_installed': printf( '<span class="theme-install">%s</span>', _x( 'Installed', 'theme' ) ); break; case 'install': default: printf( '<a class="theme-install button button-primary" href="%s">%s</a>', esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), __( 'Install' ) ); break; } ?> <h3 class="theme-name"><?php echo $name; ?></h3> <span class="theme-by"> <?php /* translators: %s: Theme author. */ printf( __( 'By %s' ), $author ); ?> </span> <?php if ( isset( $theme->screenshot_url ) ) : ?> <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" alt="" /> <?php endif; ?> <div class="theme-details"> <?php wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, ) ); ?> <div class="theme-version"> <strong><?php _e( 'Version:' ); ?> </strong>Changelog
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-theme-install-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.