Alert: 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.

_wp_translate_php_url_constant_to_key() WordPress Function

The wp_translate_php_url_constant_to_key() function is used to translate a PHP URL constant (such as "HTTP_HOST") into a WordPress key (such as "host").

_wp_translate_php_url_constant_to_key( int $constant ) #

Translate a PHP_URL_* constant to the named array keys PHP uses.


Parameters

$constant

(int)(Required)PHP*URL** constant.


Top ↑

Return

(string|false) The named key or false.


Top ↑

Source

File: wp-includes/http.php

function _wp_translate_php_url_constant_to_key( $constant ) {
	$translation = array(
		PHP_URL_SCHEME   => 'scheme',
		PHP_URL_HOST     => 'host',
		PHP_URL_PORT     => 'port',
		PHP_URL_USER     => 'user',
		PHP_URL_PASS     => 'pass',
		PHP_URL_PATH     => 'path',
		PHP_URL_QUERY    => 'query',
		PHP_URL_FRAGMENT => 'fragment',
	);

	if ( isset( $translation[ $constant ] ) ) {
		return $translation[ $constant ];
	} else {
		return false;
	}
}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.