WordPress at Your Fingertips
function is not described

WP_Site_Health_Auto_Updates::test_constants() public WP 5.2.0

Test if auto-updates related constants are set correctly.

{} It's a method of the class: WP_Site_Health_Auto_Updates{}

No Hooks.


Array. The test results.


$WP_Site_Health_Auto_Updates = new WP_Site_Health_Auto_Updates();
$WP_Site_Health_Auto_Updates->test_constants( $constant, $value );
$constant(string) (required)
The name of the constant to check.
$value(true|false|string|array) (required)
The value that the constant should be, if set, or an array of acceptable values.


Since 5.2.0 Introduced.
Since 5.5.1 The $value parameter can accept an array.

Code of WP_Site_Health_Auto_Updates::test_constants() WP 5.8.2

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: %s: Name of the constant used. */
				__( 'The %s constant is defined and enabled.' ),
			'severity'    => 'fail',