WP_Speculation_Rules::is_valid_id
Checks whether the given ID is valid.
Method of the class: WP_Speculation_Rules{}
No Hooks.
Returns
true|false
. True if the ID is valid, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->is_valid_id( $id ): bool;
- $id(string) (required)
- Unique string identifier for the speculation rule.
Changelog
Since 6.8.0 | Introduced. |
WP_Speculation_Rules::is_valid_id() WP Speculation Rules::is valid id code WP 6.8.1
private function is_valid_id( string $id ): bool { return (bool) preg_match( '/^[a-z][a-z0-9_-]+$/', $id ); }