WP_Debug_Data::get_wp_themes_inactive(): array<string,
- Since
- 6.7.0
- Source
wp-admin/includes/class-wp-debug-data.php:1370
Compatibility
- WordPress
- since 6.7.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.
Return value
array<string,- string|bool|array> The inactive themes debug data.
Performance profile
How much work a call to WP_Debug_Data::get_wp_themes_inactive() 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
- Heavy
- Scaling
- Scales with input
- Instructions
- 32–39
- Plugin surface
- 1 hook
- Called by
- 1
Reads stored settings via get_site_option(), cached per request but not free on a cold cache.
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 206.
Third-party callbacks on 'theme_auto_update_debug_string' 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
- transienttransient
get_site_transient()called directly - optionnetwork option
get_site_option()called directly - hookthird-party callbacks
apply_filters()called directly - cacheobject cache
wp_cache_get()one call below WP_Debug_Data::get_wp_themes_inactive()
Further down the call graph this can also reach 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 · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Debug_Data::get_wp_themes_inactive() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 32–33 | wp_get_theme(), ->parent(), get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_themes(), __() |
| always | 38–39 | wp_get_theme(), ->parent(), get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_themes(), __() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 206 | 32–39 | 16 | |
| 8.5 | 206 | 32–39 | 16 | |
| 8.4 | 206 | 32–39 | 16 | 9 fewer instructions than PHP 8.3 |
| 8.3 | 215 | 32–39 | 16 | |
| 8.2 | 215 | 32–39 | 16 | |
| 8.1 | 215 | 32–39 | 16 | |
| 7.4 | 215 | 32–39 | 16 |
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 · 1
One hook fires while WP_Debug_Data::get_wp_themes_inactive() runs, in this order:
- apply_filters( theme_auto_update_debug_string )filterline 1469 (+99 into the body)
Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
Uses · 11
- wp_get_theme()Gets a WP_Theme object for a theme.
- get_theme_updates()Retrieves themes with updates available.
- get_site_transient()Retrieves the value of a site transient.
- wp_is_auto_update_enabled_for_type()Checks whether auto-updates are enabled.
- get_site_option()Retrieve an option value for the current network based on name of option.
- wp_get_themes()Returns an array of WP_Theme objects based on the arguments.
- wp_kses()Filters text content and strips out disallowed HTML.
- __()Retrieves the translation of $text.
- wp_is_auto_update_forced_for_item()Checks whether auto-updates are forced for an item.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- sanitize_text_field()Sanitizes a string from user input or from the database.
Used by · 1
- WP_Debug_Data::debug_data()Static function for generating site debug data when required.
Source code
private static function get_wp_themes_inactive(): array { $active_theme = wp_get_theme(); $parent_theme = $active_theme->parent(); $theme_updates = get_theme_updates(); $transient = get_site_transient( 'update_themes' ); $auto_updates = array(); $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' ); if ( $auto_updates_enabled ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); } // Populate a list of all themes available in the installation. $all_themes = wp_get_themes(); $fields = array(); foreach ( $all_themes as $theme_slug => $theme ) { // Exclude the currently active theme from the list of all themes. if ( $active_theme->stylesheet === $theme_slug ) { continue; } // Exclude the currently active parent theme from the list of all themes. if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) { continue; } $theme_version = $theme->version; $theme_author = $theme->author; // Sanitize. $theme_author = wp_kses( $theme_author, array() ); $theme_version_string = __( 'No version or author information is available.' ); $theme_version_string_debug = 'undefined'; if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) { /* translators: 1: Theme version number. 2: Theme author name. */ $theme_version_string = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author ); $theme_version_string_debug = sprintf( 'version: %s, author: %s', $theme_version, $theme_author ); } else { if ( ! empty( $theme_author ) ) { /* translators: %s: Theme author name. */ $theme_version_string = sprintf( __( 'By %s' ), $theme_author ); $theme_version_string_debug = sprintf( 'author: %s, version: (undefined)', $theme_author ); } if ( ! empty( $theme_version ) ) { /* translators: %s: Theme version number. */ $theme_version_string = sprintf( __( 'Version %s' ), $theme_version ); $theme_version_string_debug = sprintf( 'author: (undefined), version: %s', $theme_version ); } } if ( array_key_exists( $theme_slug, $theme_updates ) ) { /* translators: %s: Latest theme version number. */ $theme_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] ); $theme_version_string_debug .= sprintf( ' (latest version: %s)', $theme_updates[ $theme_slug ]->update['new_version'] ); } if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $theme_slug ] ) ) { $item = $transient->response[ $theme_slug ]; } elseif ( isset( $transient->no_update[ $theme_slug ] ) ) { $item = $transient->no_update[ $theme_slug ]; } else { $item = array( 'theme' => $theme_slug, 'new_version' => $theme->version, 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced;Changelog
Introduced in 6.7.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
array to array<string,.verified against sourceAbout this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-admin/includes/class-wp-debug-data.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.