Tests if auto-updates related constants are set correctly.
$constantstringrequired
$valuebool|string|arrayrequired
public function test_constants( $constant, $value ) {
$acceptable_values = (array) $value;
if ( defined( $constant ) && ! in_array( constant( $constant ), $acceptable_values, true ) ) {
return array(
'description' => sprintf(
/* translators: 1: Name of the constant used. 2: Value of the constant used. */
__( 'The %1$s constant is defined as %2$s' ),
"<code>$constant</code>",
'<code>' . esc_html( var_export( constant( $constant ), true ) ) . '</code>'
),
'severity' => 'fail',
);
}
}
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_site_health_auto_updates/test_constants