WP_Debug_Data::get_wp_parent_theme(): array<string,
- Since
- 6.7.0
- Source
wp-admin/includes/class-wp-debug-data.php:1258
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|array> The parent theme debug data.
Performance profile
How much work a call to WP_Debug_Data::get_wp_parent_theme() 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
- Moderate
- Scaling
- Constant
- Instructions
- 27–169
- Plugin surface
- 1 hook
- Called by
- 1
Reads stored settings via get_site_option(), cached per request but not free on a cold cache.
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 186.
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_parent_theme()
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 · 18 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_parent_theme() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 27 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), __() |
| always | 33 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), __() |
!$theme_updates | 93–94 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), __() |
!$theme_updates | 95–96 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), __() |
!$theme_updates | 99–100 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), __() |
!$theme_updates | 101–102 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), __() |
$theme_updates | 110–111 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), __() |
$theme_updates | 112–113 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), __() |
$theme_updates | 116–117 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), __() |
$theme_updates | 118–119 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), __() |
!$theme_updates | 132–144 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
!$theme_updates | 134–146 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
6 further outcomes, up to 169 instructions
!$theme_updates | 138–150 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
!$theme_updates | 140–152 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
$theme_updates | 149–161 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
$theme_updates | 151–163 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
$theme_updates | 155–167 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
$theme_updates | 157–169 | get_theme_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_theme(), ->parent(), __(), sprintf(), ->display(), __(), __(), sprintf(), __(), __(), wp_kses(), __(), __(), __(), get_template_directory(), wp_is_auto_update_forced_for_item(), __(), apply_filters(), __(), __() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 185 | 27–168 | 10 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 186 | 27–169 | 10 | |
| 8.4 | 186 | 27–169 | 10 | 4 fewer instructions than PHP 8.3 |
| 8.3 | 190 | 27–173 | 10 | |
| 8.2 | 190 | 27–173 | 10 | |
| 8.1 | 190 | 27–173 | 10 | |
| 7.4 | 190 | 27–173 | 10 |
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_parent_theme() runs, in this order:
- apply_filters( theme_auto_update_debug_string )filterline 1347 (+89 into the body)
Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
Uses · 10
- 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_theme()Gets a WP_Theme object for a theme.
- __()Retrieves the translation of $text.
- wp_kses()Filters text content and strips out disallowed HTML.
- get_template_directory()Retrieves template directory path for the active theme.
- 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.
Used by · 1
- WP_Debug_Data::debug_data()Static function for generating site debug data when required.
Source code
private static function get_wp_parent_theme(): array { $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() ); } $active_theme = wp_get_theme(); $parent_theme = $active_theme->parent(); $fields = array(); if ( $parent_theme ) { $parent_theme_version = $parent_theme->version; $parent_theme_version_debug = $parent_theme_version; if ( array_key_exists( $parent_theme->stylesheet, $theme_updates ) ) { $parent_theme_update_new_version = $theme_updates[ $parent_theme->stylesheet ]->update['new_version']; /* translators: %s: Latest theme version number. */ $parent_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $parent_theme_update_new_version ); $parent_theme_version_debug .= sprintf( ' (latest version: %s)', $parent_theme_update_new_version ); } $parent_theme_author_uri = $parent_theme->display( 'AuthorURI' ); $fields = array( 'name' => array( 'label' => __( 'Name' ), 'value' => sprintf( /* translators: 1: Theme name. 2: Theme slug. */ __( '%1$s (%2$s)' ), $parent_theme->name, $parent_theme->stylesheet ), ), 'version' => array( 'label' => __( 'Version' ), 'value' => $parent_theme_version, 'debug' => $parent_theme_version_debug, ), 'author' => array( 'label' => __( 'Author' ), 'value' => wp_kses( $parent_theme->author, array() ), ), 'author_website' => array( 'label' => __( 'Author website' ), 'value' => ( $parent_theme_author_uri ? $parent_theme_author_uri : __( 'Undefined' ) ), 'debug' => ( $parent_theme_author_uri ? $parent_theme_author_uri : '(undefined)' ), ), 'theme_path' => array( 'label' => __( 'Theme directory location' ), 'value' => get_template_directory(), ), ); if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $parent_theme->stylesheet ] ) ) { $item = $transient->response[ $parent_theme->stylesheet ]; } elseif ( isset( $transient->no_update[ $parent_theme->stylesheet ] ) ) { $item = $transient->no_update[ $parent_theme->stylesheet ]; } else { $item = array( 'theme' => $parent_theme->stylesheet, 'new_version' => $parent_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; } else { $enabled = in_array( $parent_theme->stylesheet, $auto_updates, true );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.