WP_Debug_Data::get_wp_plugins_raw_data(): array<string,
- Since
- 6.7.0
- Source
wp-admin/includes/class-wp-debug-data.php:991
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,- array<string, array<string, string>>> The raw plugin debug data for active and inactive plugins.
Performance profile
How much work a call to WP_Debug_Data::get_wp_plugins_raw_data() 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
- 20–27
- Plugin surface
- 1 hook
- Called by
- 2
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 195.
Third-party callbacks on 'plugin_auto_update_debug_string' run inside this call, and their cost is not bounded by anything here.
2 places 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_plugins_raw_data()
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_plugins_raw_data() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 20–21 | get_plugins(), get_plugin_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type() |
| always | 26–27 | get_plugins(), get_plugin_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 195 | 20–27 | 14 | |
| 8.5 | 195 | 20–27 | 14 | |
| 8.4 | 195 | 20–27 | 14 | 9 fewer instructions than PHP 8.3 |
| 8.3 | 204 | 20–27 | 14 | |
| 8.2 | 204 | 20–27 | 14 | |
| 8.1 | 204 | 20–27 | 14 | |
| 7.4 | 204 | 20–27 | 14 |
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_plugins_raw_data() runs, in this order:
- apply_filters( plugin_auto_update_debug_string )filterline 1089 (+98 into the body)
Filters the text string of the auto-updates setting for each plugin in the Site Health debug data.
Uses · 12
- get_plugins()Checks the plugins directory and retrieve all plugin files with plugin data.
- get_plugin_updates()Retrieves plugins 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.
- is_plugin_active()Determines whether a plugin is active.
- __()Retrieves the translation of $text.
- wp_parse_args()Merges user defined arguments into defaults array.
- 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.
- stdClass::__construct()
Used by · 2
- WP_Debug_Data::get_wp_plugins_active()Gets the WordPress active plugins section of the debug data.
- WP_Debug_Data::get_wp_plugins_inactive()Gets the WordPress inactive plugins section of the debug data.
Source code
private static function get_wp_plugins_raw_data(): array { // List all available plugins. $plugins = get_plugins(); $plugin_updates = get_plugin_updates(); $transient = get_site_transient( 'update_plugins' ); $auto_updates = array(); $fields = array( 'wp-plugins-active' => array(), 'wp-plugins-inactive' => array(), ); $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' ); if ( $auto_updates_enabled ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); } foreach ( $plugins as $plugin_path => $plugin ) { $plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive'; $plugin_version = $plugin['Version']; $plugin_author = $plugin['Author']; $plugin_version_string = __( 'No version or author information is available.' ); $plugin_version_string_debug = 'author: (undefined), version: (undefined)'; if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) { /* translators: 1: Plugin version number. 2: Plugin author name. */ $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author ); $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author ); } else { if ( ! empty( $plugin_author ) ) { /* translators: %s: Plugin author name. */ $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author ); $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author ); } if ( ! empty( $plugin_version ) ) { /* translators: %s: Plugin version number. */ $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version ); $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version ); } } if ( array_key_exists( $plugin_path, $plugin_updates ) ) { /* translators: %s: Latest plugin version number. */ $plugin_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version ); $plugin_version_string_debug .= sprintf( ' (latest version: %s)', $plugin_updates[ $plugin_path ]->update->new_version ); } if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $plugin_path ] ) ) { $item = $transient->response[ $plugin_path ]; } elseif ( isset( $transient->no_update[ $plugin_path ] ) ) { $item = $transient->no_update[ $plugin_path ]; } else { $item = array( 'id' => $plugin_path, 'slug' => '', 'plugin' => $plugin_path, 'new_version' => '', 'url' => '', 'package' => '', 'icons' => array(), 'banners' => array(), 'banners_rtl' => array(), 'tested' => '', 'requires_php' => '', 'compatibility' => new stdClass(), ); $item = wp_parse_args( $plugin, $item ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $plugin_path, $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.