# get_header_image()

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

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

## Сигнатура

```php
get_header_image(): string|false
```

## Описание

Получает изображение заголовка для произвольного заголовка.

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

`string|false`

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

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

```php
function get_header_image() {
	$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );

	if ( 'remove-header' === $url ) {
		return false;
	}

	if ( is_random_header_image() ) {
		$url = get_random_header_image();
	}

	/**
	 * Filters the header image URL.
	 *
	 * @since 6.1.0
	 *
	 * @param string $url Header image URL.
	 */
	$url = apply_filters( 'get_header_image', $url );

	if ( ! is_string( $url ) ) {
		return false;
	}

	$url = trim( $url );
	return sanitize_url( set_url_scheme( $url ) );
}
```

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

- 2.1.0 — Introduced.

## Связанные

Использует: [`get_theme_support`](https://chugunov.pro/api-wordpress/functions/get_theme_support/), [`is_random_header_image`](https://chugunov.pro/api-wordpress/functions/is_random_header_image/), [`get_random_header_image`](https://chugunov.pro/api-wordpress/functions/get_random_header_image/), [`get_theme_mod`](https://chugunov.pro/api-wordpress/functions/get_theme_mod/), [`set_url_scheme`](https://chugunov.pro/api-wordpress/functions/set_url_scheme/), [`sanitize_url`](https://chugunov.pro/api-wordpress/functions/sanitize_url/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`get_media_states`](https://chugunov.pro/api-wordpress/functions/get_media_states/), [`get_header_video_settings`](https://chugunov.pro/api-wordpress/functions/get_header_video_settings/), [`get_header_image_tag`](https://chugunov.pro/api-wordpress/functions/get_header_image_tag/), [`has_header_image`](https://chugunov.pro/api-wordpress/functions/has_header_image/), `Custom_Image_Header::step_1`, [`_delete_attachment_theme_mod`](https://chugunov.pro/api-wordpress/functions/_delete_attachment_theme_mod/), [`header_image`](https://chugunov.pro/api-wordpress/functions/header_image/).

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