Skip to main content

Maintenance Mode

Overview

Maintenance mode shows a "Briefly unavailable for scheduled maintenance" page to all visitors while you perform updates, migrations, or repairs. WP-CLI lets you enable and disable it with a single command — without touching the filesystem manually.

How WordPress Maintenance Mode Works

WordPress maintenance mode is controlled by a .maintenance file in the WordPress root. When the file exists, WordPress displays the maintenance screen to all non-admin visitors.

WordPress root/
├── .maintenance ← Created by wp maintenance-mode activate
├── wp-config.php
├── wp-login.php
└── wp-content/

The file contains:

<?php $upgrading = 1234567890; ?>

WordPress reads this file and — if $upgrading is within the last 10 minutes — shows the maintenance page.

When to Use

ScenarioAction
Running wp core updateActivate before, deactivate after
Running wp plugin update --allActivate + deactivate
Running wp db import / migrationsActivate before import
Checksum failure investigationActivate immediately
Deploying code changesActivate during deploy

Basic Workflow

# 1. Activate maintenance mode (visitors see maintenance page)
wp maintenance-mode activate

# 2. Do your work
wp core update
wp plugin update --all
wp cache flush

# 3. Deactivate when done
wp maintenance-mode deactivate

# 4. Verify
wp maintenance-mode status

Subcommands

CommandDescription
wp maintenance-mode activateEnable maintenance mode
wp maintenance-mode deactivateDisable maintenance mode
wp maintenance-mode statusCheck current state

Next Steps