# path_is_absolute()

URL: https://chugunov.pro/api-wordpress/functions/path_is_absolute/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 2.5.0.

## Сигнатура

```php
path_is_absolute( string $path ): bool
```

## Описание

Например, '/foo/bar' или 'c:\windows'.

## Параметры

- `$path` `string` — обязательный. Путь к файлу.

## Возвращаемое значение

`bool`

## Исходный код

Файл: `wp-includes/functions.php:2120`

```php
function path_is_absolute( $path ) {
	/*
	 * Check to see if the path is a stream and check to see if its an actual
	 * path or file as realpath() does not support stream wrappers.
	 */
	if ( wp_is_stream( $path ) && ( is_dir( $path ) || is_file( $path ) ) ) {
		return true;
	}

	/*
	 * This is definitive if true but fails if $path does not exist or contains
	 * a symbolic link.
	 */
	if ( realpath( $path ) === $path ) {
		return true;
	}

	if ( strlen( $path ) === 0 || '.' === $path[0] ) {
		return false;
	}

	// Windows allows absolute paths like this.
	if ( preg_match( '#^[a-zA-Z]:\\\\#', $path ) ) {
		return true;
	}

	// A path starting with / or \ is absolute; anything else is relative.
	return ( '/' === $path[0] || '\\' === $path[0] );
}
```

## История изменений

- 2.5.0 — Introduced.

## Связанные

Использует: [`wp_is_stream`](https://chugunov.pro/api-wordpress/functions/wp_is_stream/).
Используется в: [`path_join`](https://chugunov.pro/api-wordpress/functions/path_join/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/path_is_absolute/
