# wp_convert_bytes_to_hr()

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

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

> Устаревший элемент. Помечен устаревшим с версии 3.6.0.

## Сигнатура

```php
wp_convert_bytes_to_hr( int $bytes ): string
```

## Описание

См. alsosize_format()

## Параметры

- `$bytes` `int` — обязательный. Целочисленное значение в байтах.

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

`string`

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

Файл: `wp-includes/deprecated.php:3374`

```php
function wp_convert_bytes_to_hr( $bytes ) {
	_deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' );

	$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
	$log   = log( $bytes, KB_IN_BYTES );
	$power = ! is_nan( $log ) && ! is_infinite( $log ) ? (int) $log : 0;
	$size  = KB_IN_BYTES ** ( $log - $power );

	if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
		$unit = $units[ $power ];
	} else {
		$size = $bytes;
		$unit = $units[0];
	}

	return $size . $unit;
}
```

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

- 3.6.0 — Deprecated. Use size_format()
- 2.3.0 — Introduced.

## Связанные

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

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