# get_uploaded_header_images()

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

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

## Сигнатура

```php
get_uploaded_header_images(): array
```

## Описание

Получает изображения заголовка, загруженные для активной темы.

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

`array`

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

Файл: `wp-includes/theme.php:1510`

```php
function get_uploaded_header_images() {
	$header_images = array();

	$headers = get_posts(
		array(
			'post_type'  => 'attachment',
			'meta_key'   => '_wp_attachment_is_custom_header',
			'meta_value' => get_option( 'stylesheet' ),
			'orderby'    => 'none',
			'nopaging'   => true,
		)
	);

	if ( empty( $headers ) ) {
		return array();
	}

	foreach ( (array) $headers as $header ) {
		$url          = sanitize_url( wp_get_attachment_url( $header->ID ) );
		$header_data  = wp_get_attachment_metadata( $header->ID );
		$header_index = $header->ID;

		$header_images[ $header_index ]                      = array();
		$header_images[ $header_index ]['attachment_id']     = $header->ID;
		$header_images[ $header_index ]['url']               = $url;
		$header_images[ $header_index ]['thumbnail_url']     = $url;
		$header_images[ $header_index ]['alt_text']          = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
		$header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'] ?? '';

		if ( isset( $header_data['width'] ) ) {
			$header_images[ $header_index ]['width'] = $header_data['width'];
		}
		if ( isset( $header_data['height'] ) ) {
			$header_images[ $header_index ]['height'] = $header_data['height'];
		}
	}

	return $header_images;
}
```

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

- 3.2.0 — Introduced.

## Связанные

Использует: [`wp_get_attachment_url`](https://chugunov.pro/api-wordpress/functions/wp_get_attachment_url/), [`wp_get_attachment_metadata`](https://chugunov.pro/api-wordpress/functions/wp_get_attachment_metadata/), [`get_posts`](https://chugunov.pro/api-wordpress/functions/get_posts/), [`sanitize_url`](https://chugunov.pro/api-wordpress/functions/sanitize_url/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/), [`get_post_meta`](https://chugunov.pro/api-wordpress/functions/get_post_meta/).
Используется в: [`get_media_states`](https://chugunov.pro/api-wordpress/functions/get_media_states/), `Custom_Image_Header::get_uploaded_header_images`, `Custom_Image_Header::step_1`, `Custom_Image_Header::set_header_image`, `Custom_Image_Header::show_header_selector`, [`_get_random_header_data`](https://chugunov.pro/api-wordpress/functions/_get_random_header_data/).

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