WP_REST_Request::canonicalize_header_name()public staticWP 4.4.0

Canonicalizes the header name.

Ensures that header names are always treated the same regardless of source. Header names are always case insensitive.

Note that we treat - (dashes) and _ (underscores) as the same character, as per header parsing rules in both Apache and nginx.

Метод класса: WP_REST_Request{}

Хуков нет.

Возвращает

Строку. Canonicalized name.

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

$result = WP_REST_Request::canonicalize_header_name( $key );
$key(строка) (обязательный)
Header name.

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

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

Код WP_REST_Request::canonicalize_header_name() WP 6.4.3

public static function canonicalize_header_name( $key ) {
	$key = strtolower( $key );
	$key = str_replace( '-', '_', $key );

	return $key;
}