WPDev.one
Core Class

WP_Speculation_Rules

class WP_Speculation_Rules // Constructor: function Object() { [native code] }

Class representing a set of speculation rules.

Methods 7 methods

Method / Return Description
add_rule()
bool

Adds a speculation rule to the speculation rules to consider.

Parameters: $mode: string, $id: string, $rule: array
has_rule()
bool

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

Parameters: $mode: string, $id: string
jsonSerialize()
array<string,

Returns the speculation rules data ready to be JSON-encoded.

is_valid_id()
bool

Checks whether the given ID is valid.

Parameters: $id: string
is_valid_mode()
bool

Checks whether the given speculation rules mode is valid.

Parameters: $mode: string
is_valid_eagerness()
bool

Checks whether the given speculation rules eagerness is valid.

Parameters: $eagerness: string
is_valid_source()
bool

Checks whether the given speculation rules source is valid.

Parameters: $source: string

Properties

Property / Type Description
$rules_by_mode
mixed
public
No description available.
$mode_allowlist
mixed
public
No description available.
$eagerness_allowlist
mixed
public
No description available.
$source_allowlist
mixed
public
No description available.

Class Information

Since Version
6.8.0
Source File
wp-includes/class-wp-speculation-rules.php
Advertisement