WP_Speculation_Rules::has_rule
Checks whether a speculation rule for the given mode and ID already exists.
Метод класса: WP_Speculation_Rules{}
Хуков нет.
Возвращает
bool. True if the rule already exists, false otherwise.
Использование
$WP_Speculation_Rules = new WP_Speculation_Rules(); $WP_Speculation_Rules->has_rule( $mode, $id ): bool;
- $mode(строка) (обязательный)
- Speculative loading mode. Either
'prefetch'or'prerender'. - $id(строка) (обязательный)
- Unique string identifier for the speculation rule.
Список изменений
| С версии 6.8.0 | Введена. |
Код WP_Speculation_Rules::has_rule() WP Speculation Rules::has rule WP 7.1.3
public function has_rule( string $mode, string $id ): bool {
return isset( $this->rules_by_mode[ $mode ][ $id ] );
}