WP_Speculation_Rules::is_valid_eagernesspublic staticWP 6.8.0

Checks whether the given speculation rules eagerness is valid.

Method of the class: WP_Speculation_Rules{}

No Hooks.

Returns

bool. True if valid, false otherwise.

Usage

$result = WP_Speculation_Rules::is_valid_eagerness( $eagerness ): bool;
$eagerness(mixed) (required)
Speculation rules eagerness.

Changelog

Since 6.8.0 Introduced.
Since 7.1.0 The $eagerness param now allows mixed and not just string.

WP_Speculation_Rules::is_valid_eagerness() code WP 7.1

public static function is_valid_eagerness( $eagerness ): bool {
	return is_string( $eagerness ) && isset( self::$eagerness_allowlist[ $eagerness ] );
}