wppaste
WordPress

WP_Debug_Data::debug_data(): array

Since
5.2.0, 5.3.0, 5.5.0, 6.7.0
Source
wp-admin/includes/class-wp-debug-data.php:36
Static function for generating site debug data when required.

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
The debug data for the site.

Performance profile

How much work a call to WP_Debug_Data::debug_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
Trivial

Touches nothing outside its own arguments.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
3

Executed per call on PHP 8.5. The body compiles to 58.

Plugin surface
1 hook

Third-party callbacks on 'debug_information' run inside this call, and their cost is not bounded by anything here.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • hookthird-party callbacksapply_filters()called directly

What one call costs · 1 distinct outcome

One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Debug_Data::debug_data() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always3none

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev5830
8.55830
8.45830
8.35830
8.25830
8.158303 more instructions than PHP 7.4
7.455550

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::debug_data() runs, in this order:

  1. apply_filters( debug_information )filterline 135 (+99 into the body)

    Filters the debug information shown on the Tools -> Site Health -> Info screen.

Uses · 15

Show all 15

Source code

	public static function debug_data() {		/*		 * Set up the array that holds all debug information.		 *		 * When iterating through the debug data, the ordering of the sections		 * occurs in insertion-order of the assignments into this array.		 *		 * This is the single assignment of the sections before filtering. Null-entries will		 * be automatically be removed.		 */		$info = array(			'wp-core'             => self::get_wp_core(),			'wp-paths-sizes'      => self::get_wp_paths_sizes(),			'wp-dropins'          => self::get_wp_dropins(),			'wp-active-theme'     => self::get_wp_active_theme(),			'wp-parent-theme'     => self::get_wp_parent_theme(),			'wp-themes-inactive'  => self::get_wp_themes_inactive(),			'wp-mu-plugins'       => self::get_wp_mu_plugins(),			'wp-plugins-active'   => self::get_wp_plugins_active(),			'wp-plugins-inactive' => self::get_wp_plugins_inactive(),			'wp-media'            => self::get_wp_media(),			'wp-server'           => self::get_wp_server(),			'wp-database'         => self::get_wp_database(),			'wp-constants'        => self::get_wp_constants(),			'wp-filesystem'       => self::get_wp_filesystem(),		); 		/*		 * Remove null elements from the array. The individual methods are		 * allowed to return `null`, which communicates that the category		 * of debug data isn't relevant and shouldn't be passed through.		 */		$info = array_filter(			$info,			static function ( $section ) {				return isset( $section );			}		); 		/**		 * Filters the debug information shown on the Tools -> Site Health -> Info screen.		 *		 * Plugin or themes may wish to introduce their own debug information without creating		 * additional admin pages. They can utilize this filter to introduce their own sections		 * or add more data to existing sections.		 *		 * Array keys for sections added by core are all prefixed with `wp-`. Plugins and themes		 * should use their own slug as a prefix, both for consistency as well as avoiding		 * key collisions. Note that the array keys are used as labels for the copied data.		 *		 * All strings are expected to be plain text except `$description` that can contain		 * inline HTML tags (see below).		 *		 * @since 5.2.0		 *		 * @param array $args {		 *     The debug information to be added to the core information page.		 *		 *     This is an associative multi-dimensional array, up to three levels deep.		 *     The topmost array holds the sections, keyed by section ID.		 *		 *     @type array ...$0 {		 *         Each section has a `$fields` associative array (see below), and each `$value` in `$fields`		 *         can be another associative array of name/value pairs when there is more structured data		 *         to display.		 *		 *         @type string $label       Required. The title for this section of the debug output.		 *         @type string $description Optional. A description for your information section which		 *                                   may contain basic HTML markup, inline tags only as it is		 *                                   outputted in a paragraph.		 *         @type bool   $show_count  Optional. If set to `true`, the amount of fields will be included		 *                                   in the title for this section. Default false.		 *         @type bool   $private     Optional. If set to `true`, the section and all associated fields		 *                                   will be excluded from the copied data. Default false.		 *         @type array  $fields {		 *             Required. An associative array containing the fields to be displayed in the section,		 *             keyed by field ID.		 *		 *             @type array ...$0 {		 *                 An associative array containing the data to be displayed for the field.

Changelog

Introduced in 5.2.0. Unchanged from 6.7.7 through 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.

6.7.0
Modularized into separate theme-oriented methods.from the docblock
5.5.0
Added pretty permalinks support information.from the docblock
5.3.0
Added database charset, database collation, and timezone information.from the docblock
5.2.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 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.