wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_secrets_site_health_test_key_source › WordPress Function
Seit7.2.0
Veraltetn/v
› wp_secrets_site_health_test_key_source ( Keine Parameter )
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Site Health test: is the site key a dedicated constant, or a weaker fallback?
Quellcode
function wp_secrets_site_health_test_key_source(): array {
$key_source = _wp_secrets_get_key_manager()->get_keyring()->get_key_source();
if ( false !== strpos( $key_source, 'broken' ) ) {
return wp_secrets_site_health_result(
'secrets_api_key_source',
__( 'Secrets API key source is broken' ),
'critical',
sprintf(
'<p>%s</p>',
esc_html__( 'The active keyring did not load correctly. No secret can be encrypted or decrypted until this is fixed.' )
)
);
}
if ( false !== strpos( $key_source, 'legacy interpretation' ) ) {
return wp_secrets_site_health_result(
'secrets_api_key_source',
__( 'Secrets API key should be regenerated' ),
'recommended',
sprintf(
'<p>%s</p>',
esc_html__( 'WP_SECRETS_KEY is defined, but not in the recommended base64-encoded 32-byte form. Regenerate it with `wp secret generate-key`.' )
)
);
}
if ( false !== strpos( $key_source, 'LOGGED_IN_KEY' ) ) {
return wp_secrets_site_health_result(
'secrets_api_key_source',
__( 'Secrets API is using a fallback key' ),
'recommended',
sprintf(
'<p>%s</p>',
esc_html__( 'No dedicated WP_SECRETS_KEY constant is defined. Secrets are encrypted using a key derived from existing salts, which works but is not the recommended configuration. Define WP_SECRETS_KEY with a value from `wp secret generate-key`.' )
)
);
}
return wp_secrets_site_health_result(
'secrets_api_key_source',
__( 'Secrets API is using a dedicated key' ),
'good',
sprintf( '<p>%s</p>', esc_html( $key_source ) )
);
}