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
| Scenario | Action |
|---|---|
Running wp core update | Activate before, deactivate after |
Running wp plugin update --all | Activate + deactivate |
Running wp db import / migrations | Activate before import |
| Checksum failure investigation | Activate immediately |
| Deploying code changes | Activate 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
| Command | Description |
|---|---|
wp maintenance-mode activate | Enable maintenance mode |
wp maintenance-mode deactivate | Disable maintenance mode |
wp maintenance-mode status | Check current state |
Next Steps
wp core verify-checksums— audit file integrity before maintenance.wp cache flush— flush cache after maintenance.