wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_secrets_site_health_result › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_secrets_site_health_result ( $test, $label, $status, $description )
Parameter: (4)
  • (string) $test The test's own identifier, matching the key registered in wp_secrets_site_health_tests().
    Erforderlich: Ja
  • (string) $label Short label for the test result.
    Erforderlich: Ja
  • (string) $status One of 'good', 'recommended', 'critical'.
    Erforderlich: Ja
  • (string) $description HTML description, normally one or more <p> elements.
    Erforderlich: Ja
Gibt zurück:
  • (array)
Definiert in:
Codex:

Builds the standard shape a Site Health test callback returns.



Quellcode

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,
	);
}