WP_Debug_Data::format( array $info_array, string $data_type ): string

In this article

Formats the information gathered for debugging, in a manner suitable for copying to a forum or support ticket.

Parameters

$info_arrayarrayrequired
Information gathered from the WP_Debug_Data::debug_data() function.
$data_typestringrequired
The data type to return, either 'info' or 'debug'.

Return

string The formatted data.

Source

		),
		'WP_ENVIRONMENT_TYPE' => array(
			'label' => 'WP_ENVIRONMENT_TYPE',
			'value' => $wp_environment_type,
			'debug' => $wp_environment_type_debug,
		),
		'WP_DEVELOPMENT_MODE' => array(
			'label' => 'WP_DEVELOPMENT_MODE',
			'value' => WP_DEVELOPMENT_MODE ? WP_DEVELOPMENT_MODE : __( 'Disabled' ),
			'debug' => WP_DEVELOPMENT_MODE,
		),
		'DB_CHARSET'          => array(
			'label' => 'DB_CHARSET',
			'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' ) ),
			'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ),
		),
		'DB_COLLATE'          => array(
			'label' => 'DB_COLLATE',
			'value' => $db_collate,
			'debug' => $db_collate_debug,
		),
	);

	return array(
		'label'       => __( 'WordPress Constants' ),
		'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ),
		'fields'      => $fields,
	);
}

/**
 * Gets the WordPress database section of the debug data.
 *
 * @since 6.7.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @return array
 */
private static function get_wp_database(): array {
	global $wpdb;

	// Populate the database debug fields.
	if ( is_object( $wpdb->dbh ) ) {
		// mysqli or PDO.
		$extension = get_class( $wpdb->dbh );
	} else {
		// Unknown sql extension.
		$extension = null;
	}

	$server = $wpdb->get_var( 'SELECT VERSION()' );

	$client_version = $wpdb->dbh->client_info;

	$fields = array(
		'extension'          => array(
			'label' => __( 'Database Extension' ),
			'value' => $extension,

Changelog

VersionDescription
5.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.