W3cubDocs

/WordPress

is_allowed_http_origin( null|string $origin = null )

Determines if the HTTP origin is an authorized one.

Description

Parameters

$origin

(null|string) (Optional) Origin URL. If not provided, the value of get_http_origin() is used.

Default value: null

Return

(string) Origin URL if allowed, empty string if not.

Source

File: wp-includes/http.php

function is_allowed_http_origin( $origin = null ) {
	$origin_arg = $origin;

	if ( null === $origin ) {
		$origin = get_http_origin();
	}

	if ( $origin && ! in_array( $origin, get_allowed_http_origins() ) ) {
		$origin = '';
	}

	/**
	 * Change the allowed HTTP origin result.
	 *
	 * @since 3.4.0
	 *
	 * @param string $origin     Origin URL if allowed, empty string if not.
	 * @param string $origin_arg Original origin string passed into is_allowed_http_origin function.
	 */
	return apply_filters( 'allowed_http_origin', $origin, $origin_arg );
}

Changelog

Version Description
3.4.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_allowed_http_origin