wppaste
WordPress

WP_Debug_Data::get_wp_core(): array<string,

Since
6.7.0
Source
wp-admin/includes/class-wp-debug-data.php:147
Gets the WordPress core 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|array> The debug data for the Info screen.

Performance profile

How much work a call to WP_Debug_Data::get_wp_core() 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
Expensive

Reaches an outbound HTTP request via wp_remote_get().

Scaling
Scales with input

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

Instructions
206–264

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

Plugin surface
None

Nothing here hands control to plugin code.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • optionoption read or writeget_option()called directly
  • httpoutbound HTTP requestwp_remote_get()called directly
  • sqldatabase query->query()called directly
  • hookthird-party callbacksapply_filters()one call below WP_Debug_Data::get_wp_core()
  • cacheobject cachewp_cache_get()one call below WP_Debug_Data::get_wp_core()
  • serializeserialisationmaybe_unserialize()one call below WP_Debug_Data::get_wp_core()
  • transienttransientget_site_transient()one call below WP_Debug_Data::get_wp_core()
  • querycontent queryget_user_by()one call below WP_Debug_Data::get_wp_core()

What one call costs · 8 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_core() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
!is_multisite() && !is_wp_error()206–214get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), __()
!is_multisite() && !is_wp_error()208–216get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), __()
!is_multisite() && is_wp_error()217–225get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), gethostbyname(), ->get_error_message(), sprintf(), ->get_error_message(), __()
!is_multisite() && is_wp_error()219–227get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), gethostbyname(), ->get_error_message(), sprintf(), ->get_error_message(), __()
is_multisite() && !is_wp_error()242–251get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), get_current_blog_id(), __(), label(), ->query(), __(), __(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), __()
is_multisite() && !is_wp_error()244–253get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), get_current_blog_id(), __(), label(), ->query(), __(), __(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), __()
is_multisite() && is_wp_error()253–262get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), get_current_blog_id(), __(), label(), ->query(), __(), __(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), gethostbyname(), ->get_error_message(), sprintf(), ->get_error_message(), __()
is_multisite() && is_wp_error()255–264get_option(), is_ssl(), get_option(), get_option(), get_option(), wp_get_environment_type(), wp_get_wp_version(), get_core_updates(), __(), __(), get_locale(), __(), get_user_locale(), __(), wp_timezone_string(), __(), get_bloginfo(), __(), get_bloginfo(), __(), __(), __(), __(), __(), is_multisite(), __(), is_multisite(), __(), __(), __(), __(), __(), _x(), __(), is_multisite(), get_current_blog_id(), __(), label(), ->query(), __(), __(), __(), get_user_count(), wp_remote_get(), is_wp_error(), __(), __(), gethostbyname(), ->get_error_message(), sprintf(), ->get_error_message(), __()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev310201–2581411 fewer instructions than PHP 8.5
8.5321206–26414
8.4321206–26414
8.3321206–26414
8.2321206–26414
8.1321206–26414
7.4321206–26414

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.

Uses · 18

Show all 18

Used by · 1

Source code

	private static function get_wp_core(): array {		// Save few function calls.		$permalink_structure    = get_option( 'permalink_structure' );		$is_ssl                 = is_ssl();		$users_can_register     = get_option( 'users_can_register' );		$blog_public            = get_option( 'blog_public' );		$default_comment_status = get_option( 'default_comment_status' );		$environment_type       = wp_get_environment_type();		$core_version           = wp_get_wp_version();		$core_updates           = get_core_updates();		$core_update_needed     = ''; 		if ( is_array( $core_updates ) ) {			foreach ( $core_updates as $core => $update ) {				if ( 'upgrade' === $update->response ) {					/* translators: %s: Latest WordPress version number. */					$core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version );				} else {					$core_update_needed = '';				}			}		} 		$fields = array(			'version'                => array(				'label' => __( 'Version' ),				'value' => $core_version . $core_update_needed,				'debug' => $core_version,			),			'site_language'          => array(				'label' => __( 'Site Language' ),				'value' => get_locale(),			),			'user_language'          => array(				'label' => __( 'User Language' ),				'value' => get_user_locale(),			),			'timezone'               => array(				'label' => __( 'Timezone' ),				'value' => wp_timezone_string(),			),			'home_url'               => array(				'label'   => __( 'Home URL' ),				'value'   => get_bloginfo( 'url' ),				'private' => true,			),			'site_url'               => array(				'label'   => __( 'Site URL' ),				'value'   => get_bloginfo( 'wpurl' ),				'private' => true,			),			'permalink'              => array(				'label' => __( 'Permalink structure' ),				'value' => $permalink_structure ? $permalink_structure : __( 'No permalink structure set' ),				'debug' => $permalink_structure,			),			'https_status'           => array(				'label' => __( 'Is this site using HTTPS?' ),				'value' => $is_ssl ? __( 'Yes' ) : __( 'No' ),				'debug' => $is_ssl,			),			'multisite'              => array(				'label' => __( 'Is this a multisite?' ),				'value' => is_multisite() ? __( 'Yes' ) : __( 'No' ),				'debug' => is_multisite(),			),			'user_registration'      => array(				'label' => __( 'Can anyone register on this site?' ),				'value' => $users_can_register ? __( 'Yes' ) : __( 'No' ),				'debug' => $users_can_register,			),			'blog_public'            => array(				'label' => __( 'Is this site discouraging search engines?' ),				'value' => $blog_public ? __( 'No' ) : __( 'Yes' ),				'debug' => $blog_public,			),			'default_comment_status' => array(				'label' => __( 'Default comment status' ),				'value' => 'open' === $default_comment_status ? _x( 'Open', 'comment status' ) : _x( 'Closed', 'comment status' ),				'debug' => $default_comment_status,

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.