WP_Speculation_Rules::has_rule( string $mode, string $id ): bool

In this article

Checks whether a speculation rule for the given mode and ID already exists.

Parameters

$modestringrequired
Speculative loading mode. Either 'prefetch' or 'prerender'.
$idstringrequired
Unique string identifier for the speculation rule.

Return

bool True if the rule already exists, false otherwise.

Source

public function has_rule( string $mode, string $id ): bool {
	return isset( $this->rules_by_mode[ $mode ][ $id ] );
}

Changelog

VersionDescription
6.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.