wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_is_cross_origin_isolated_request › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_is_cross_origin_isolated_request ( Keine Parameter )
Gibt zurück:
  • (bool) True when the response will be cross-origin isolated.
Definiert in:
Codex:

Whether the current request has been set up for cross-origin isolation.

True once wp_set_up_cross_origin_isolation() has sent the Document-Isolation-Policy header for the screen being rendered, which is what lets scripts that need a cross-origin isolated page, such as the client-side media upload integration, decide whether to load at all. A plugin can isolate a screen on its own by sending the header directly, as the Gutenberg plugin does on the block editor screens, so a header already queued for the response counts too.


Quellcode

function wp_is_cross_origin_isolated_request(): bool {
	global $_wp_cross_origin_isolated;

	if ( true === $_wp_cross_origin_isolated ) {
		return true;
	}

	foreach ( headers_list() as $header ) {
		if ( 0 === stripos( $header, 'Document-Isolation-Policy:' ) ) {
			return true;
		}
	}

	return false;
}