# wp_is_maintenance_mode()

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

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

## Сигнатура

```php
wp_is_maintenance_mode(): bool
```

## Описание

Проверяет наличие файла с именем «.maintenance» в корневом каталоге WordPress.
Этот файл содержит переменную $upgrading, в которой хранится время создания файла. Если файл создан менее 10 минут назад, WordPress находится в режиме обслуживания.

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

`bool`

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

Файл: `wp-includes/load.php:437`

```php
function wp_is_maintenance_mode() {
	global $upgrading;

	if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) {
		return false;
	}

	require ABSPATH . '.maintenance';

	// If the $upgrading timestamp is older than 10 minutes, consider maintenance over.
	if ( ( time() - $upgrading ) >= 10 * MINUTE_IN_SECONDS ) {
		return false;
	}

	// Don't enable maintenance mode while scraping for fatal errors.
	if ( is_int( $upgrading ) && isset( $_REQUEST['wp_scrape_key'], $_REQUEST['wp_scrape_nonce'] ) ) {
		$key   = stripslashes( $_REQUEST['wp_scrape_key'] );
		$nonce = stripslashes( $_REQUEST['wp_scrape_nonce'] );

		if ( md5( $upgrading ) === $key && (int) $nonce === $upgrading ) {
			return false;
		}
	}

	/**
	 * Filters whether to enable maintenance mode.
	 *
	 * This filter runs before it can be used by plugins. It is designed for
	 * non-web runtimes. If this filter returns true, maintenance mode will be
	 * active and the request will end. If false, the request will be allowed to
	 * continue processing even if maintenance mode should be active.
	 *
	 * @since 4.6.0
	 *
	 * @param bool $enable_checks Whether to enable maintenance mode. Default true.
	 * @param int  $upgrading     The timestamp set in the .maintenance file.
	 */
	if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) {
		return false;
	}

	return true;
}
```

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

- 5.5.0 — Introduced.

## Связанные

Использует: [`wp_installing`](https://chugunov.pro/api-wordpress/functions/wp_installing/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: `WP_Fatal_Error_Handler::handle`, [`wp_maintenance`](https://chugunov.pro/api-wordpress/functions/wp_maintenance/).

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