wp_print_speculation_rules()

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Prints the speculation rules.

Description

For browsers that do not support speculation rules yet, the script[type="speculationrules"] tag will be ignored.

Source

function wp_print_speculation_rules(): void {
	$speculation_rules = wp_get_speculation_rules();
	if ( null === $speculation_rules ) {
		return;
	}

	wp_print_inline_script_tag(
		(string) wp_json_encode(
			$speculation_rules,
			JSON_HEX_TAG | JSON_UNESCAPED_SLASHES
		),
		array( 'type' => 'speculationrules' )
	);
}

Changelog

VersionDescription
6.8.0Introduced.

User Contributed Notes

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