REST API & Developer PHP Beginner

Add Your Own Section to Site Health Info

Add a "Site setup" section to Tools > Site Health > Info with details you want in every support report.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 28 lines
add_filter( 'debug_information', function ( array $info ): array {
	$info['nahnu-site'] = [
		'label'  => 'Site setup',
		'fields' => [
			'environment' => [
				'label' => 'Environment',
				'value' => wp_get_environment_type(),
			],
			'theme' => [
				'label' => 'Active theme',
				'value' => wp_get_theme()->get( 'Name' ) . ' ' . wp_get_theme()->get( 'Version' ),
			],
			'file_edit' => [
				'label' => 'File editing in admin',
				'value' => defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ? 'Off' : 'On',
			],
			'mu_plugins' => [
				'label' => 'Must-use plugins',
				'value' => (string) count( get_mu_plugins() ),
			],
			'cron' => [
				'label' => 'WP-Cron',
				'value' => defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ? 'Server cron' : 'WP-Cron',
			],
		],
	];
	return $info;
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

Site Health Info has a “Copy site info to clipboard” button that’s ideal for support requests. Adding your own section means the details you always ask for are included automatically.

How it works

The debug_information filter returns every section shown on the Info tab. The snippet adds one with a label and a list of fields. Each field has a label and a value, and is included when someone copies the site info.

You can add a 'private' => true key to a field to leave it out of the copied report.

Things to watch

  • Never add passwords, API keys or licence keys. Site info is often pasted into public support forums.

How to test it

Go to Tools → Site Health → Info. A “Site setup” section should appear.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only