wppaste
WordPress

WP_Debug_Data::get_wp_themes_inactive(): array<string,

Since
6.7.0
Source
wp-admin/includes/class-wp-debug-data.php:1370
Gets the WordPress inactive themes section of the debug data.

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

Reads stored settings via get_site_option(), cached per request but not free on a cold cache.

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
32–39

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

Plugin surface
1 hook

Third-party callbacks on 'theme_auto_update_debug_string' 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

  • transienttransientget_site_transient()called directly
  • optionnetwork optionget_site_option()called directly
  • hookthird-party callbacksapply_filters()called directly
  • cacheobject cachewp_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.

WhenInstructionsCalls it makes
always32–33wp_get_theme(), ->parent(), get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_themes(), __()
always38–39wp_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

PHPCompiledExecutedBranchesNotes
8.6-dev20632–3916
8.520632–3916
8.420632–39169 fewer instructions than PHP 8.3
8.321532–3916
8.221532–3916
8.121532–3916
7.421532–3916

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:

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

Used by · 1

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.

  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.

7.0.4
Return type changed from array to array<string,.verified against source
6.7.0
Introduced.from the docblock

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