wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_secrets_site_health_result › WordPress Function

Since7.2.0
Deprecatedn/a
› wp_secrets_site_health_result ( $test, $label, $status, $description )
Parameters: (4)
  • (string) $test The test's own identifier, matching the key registered in wp_secrets_site_health_tests().
    Required: Yes
  • (string) $label Short label for the test result.
    Required: Yes
  • (string) $status One of 'good', 'recommended', 'critical'.
    Required: Yes
  • (string) $description HTML description, normally one or more <p> elements.
    Required: Yes
Returns:
  • (array)
Defined at:
Codex:

Builds the standard shape a Site Health test callback returns.



Source

function wp_secrets_site_health_result( string $test, string $label, string $status, string $description ): array {
	$colors = array(
		'good'        => 'green',
		'recommended' => 'orange',
		'critical'    => 'red',
	);

	return array(
		'test'        => $test,
		'label'       => $label,
		'status'      => $status,
		'badge'       => array(
			'label' => __( 'Security' ),
			'color' => isset( $colors[ $status ] ) ? $colors[ $status ] : 'blue',
		),
		'description' => $description,
	);
}