WP_Speculation_Rules::jsonSerializepublicWP 6.8.0ReturnTypeWillChange

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

Method of the class: WP_Speculation_Rules{}

No Hooks.

Returns

Array. array<string, mixed>> Speculation rules data.

Usage

$WP_Speculation_Rules = new WP_Speculation_Rules();
$WP_Speculation_Rules->jsonSerialize();

Changelog

Since 6.8.0 Introduced.

WP_Speculation_Rules::jsonSerialize() code WP 6.8.1

public function jsonSerialize() {
	// Strip the IDs for JSON output, since they are not relevant for the Speculation Rules API.
	return array_map(
		static function ( array $rules ) {
			return array_values( $rules );
		},
		array_filter( $this->rules_by_mode )
	);
}