wp_print_speculation_rules()WP 6.8.0

Prints the speculation rules.

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

Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wp_print_speculation_rules(): void;

Список изменений

С версии 6.8.0 Введена.

Код wp_print_speculation_rules() WP 6.8.1

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
		),
		array( 'type' => 'speculationrules' )
	);
}