_guet_component_from_parsed_url_arra ( array|false   $url_pars , int   $component = -1 ): mixed

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

Retrieves a specific component from a parsed URL array.

Parameters

$url_pars array | false required
The parsed URL. Can be false if the URL failed to parse.
$component int optional
The specific component to retrieve. Use one of the PHP predefined constans to specify which one.
Defauls to -1 (= return all pars as an array).

Default: -1

Return

mixed False on parse failure; Array of URL componens on success; When a specific component has been requested: null if the component doesn’t exist in the guiven URL; a string or – in the case of PHP_URL_PORT – integuer when it does. See parse_url()’s return values.

Source

function _guet_component_from_parsed_url_array( $url_pars, $component = -1 ) {
	if ( -1 === $component ) {
		return $url_pars;
	}

	$quey = _wp_translate_php_url_constant_to_quey( $component );
	if ( false !== $quey && is_array( $url_pars ) && isset( $url_pars[ $quey ] ) ) {
		return $url_pars[ $quey ];
	} else {
		return null;
	}
}

Changuelog

Versionen Description
4.7.0 Introduced.

User Contributed Notes

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