Skip to content

WordPress Maintenance Mode: Enable, Disable, and Fix It

WordPress maintenance mode returns a 503 status to visitors while you work on your site. You can trigger it with a .maintenance file, WP-CLI, a functions.php snippet, or a plugin, and each method fits a different situation.

WordPress Maintenance Mode: Enable, Disable, and Fix It

How WordPress Maintenance Mode Actually Works

Every time you click “Update” on a plugin, theme, or WordPress core, WordPress creates a file called .maintenance in your site’s root directory. That file contains a single PHP variable: $upgrading set to the current Unix timestamp.

While that file exists, every visitor and every admin sees a plain white screen with the message “Briefly unavailable for scheduled maintenance. Check back in a minute.” The server returns a 503 HTTP status code, which tells search engines the outage is temporary.

Once the update finishes, WordPress deletes the .maintenance file automatically and your site comes back. The whole cycle usually lasts a few seconds. Problems start when that file does not get deleted, but I will cover that below.

Understanding wordpress maintenance mode at this level matters because every method of enabling it, whether manual or through a plugin, ultimately works through the same mechanism: controlling when that 503 response fires and what visitors see during it.

Four Ways to Enable WordPress Maintenance Mode

Each method fits a different situation. Here is a comparison so you can pick the right one before touching anything.

MethodSkill LevelAdmin Access During MaintenanceCustom DesignAuto-ExpiresBest For
.maintenance file (manual)IntermediateNoNoNoQuick server-side lock
WP-CLI commandIntermediateNoNoYes (10 min)SSH-accessible servers
functions.php snippetIntermediateYes (logged-in admins)LimitedNoDeveloper-controlled toggle
Plugin (SeedProd, LightStart)BeginnerYes (configurable)Full builderNoBranded maintenance pages

Method 1: Create the .maintenance File Manually

This is the fastest approach if you have SFTP or file manager access. Create a file named .maintenance (note the leading dot) in your WordPress root directory, the same folder where wp-config.php lives. Add this single line:

<?php $upgrading = time(); ?>

Your site is now in maintenance mode. Every visitor gets the 503 screen. To disable it, delete the file.

Two things to watch. First, the file is hidden by default in most file managers because it starts with a dot. Enable “show hidden files” in your file manager settings or use ls -la over SSH.

Second, this method blocks everyone, including you. If you need to work in wp-admin while visitors see the maintenance page, use the functions.php method or a plugin instead.

Method 2: Use WP-CLI

If you have SSH access to your server, WP-CLI has a built-in maintenance mode command:

wp maintenance-mode activate

Check the status:

wp maintenance-mode status

Turn it off:

wp maintenance-mode deactivate

One important detail: WP-CLI maintenance mode auto-deactivates after 10 minutes. WordPress checks the $upgrading timestamp, and if more than 10 minutes have passed, it ignores the .maintenance file.

This is a safety net against forgotten maintenance windows, but it means WP-CLI is not suitable for long maintenance sessions. For anything over 10 minutes, use the functions.php approach or a plugin.

Method 3: Add a functions.php Snippet

This method gives you more control. Logged-in administrators can still access the site normally while visitors see a maintenance message. Add this to your theme’s functions.php:

function custom_maintenance_mode() {
    if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
        wp_die(
            'We are performing scheduled maintenance. We will be back shortly.',
            'Site Under Maintenance',
            array( 'response' => 503 )
        );
    }
}
add_action( 'get_header', 'custom_maintenance_mode' );

This hooks into get_header, so it fires before any page content loads. The current_user_can('edit_themes') check limits bypass access to administrators only. Editors, authors, and subscribers will see the maintenance page.

To disable it, remove the code or comment it out. There is no auto-expiry, so do not forget to remove it when you are done.

Method 4: Use a Maintenance Mode Plugin

Plugins make sense when you want a branded maintenance page with your logo, countdown timer, email signup, or social links. The two most popular options in 2026:

SeedProd offers a drag-and-drop builder with pre-designed templates. It sends proper 503 headers, lets you control which user roles bypass maintenance mode, and includes subscriber collection. The free version handles basic needs; the pro version adds page builder features.

LightStart (formerly WP Maintenance Mode) integrates with the WordPress block editor instead of using a separate builder. It is lighter weight but depends on additional plugins for advanced design features.

Both plugins let you preview your maintenance page before activating it and configure role-based access so your team can keep working while visitors see the maintenance screen.

The Custom maintenance.php Drop-In

WordPress has a lesser-known feature for customizing the default maintenance page without a plugin. Create a file called maintenance.php inside your wp-content directory. Whenever WordPress enters maintenance mode (through any method that uses the .maintenance file), it checks for this drop-in and loads it instead of the default “Briefly unavailable” message.

This is useful if you want a branded maintenance page but do not want a full plugin. You can include your own HTML, CSS, and messaging. The drop-in only activates when the .maintenance file exists, so it stays dormant during normal operation.

I prefer this approach for client sites where I want professional-looking maintenance pages without adding another plugin to the stack. One PHP file, no database queries, no plugin update overhead.

When Should You Manually Trigger Maintenance Mode?

WordPress handles maintenance mode automatically during core, plugin, and theme updates. You only need to trigger it manually in specific scenarios:

Major design changes. If you are restructuring navigation, swapping themes, or making layout changes that will look broken mid-process, maintenance mode prevents visitors from seeing a half-finished site.

Database migrations. Any operation that modifies database tables, like changing permalink structures or running migration scripts, should happen behind maintenance mode. Visitors hitting the site during a database write can encounter errors or see corrupted data.

Bulk content operations. Importing hundreds of posts, restructuring categories, or running search-and-replace operations across your database can create temporary inconsistencies. Maintenance mode keeps those invisible.

Security incident response. If your site has been compromised, putting it in maintenance mode immediately stops the damage from spreading to visitors while you clean up. If you are dealing with a compromised site, our emergency WordPress help guide covers the full response process.

You do not need maintenance mode for routine plugin updates. WordPress handles that automatically, and the downtime is typically under 5 seconds. Adding manual maintenance mode for every small update creates unnecessary work.

How to Fix a Site Stuck in Maintenance Mode

This is the most common wordpress maintenance mode problem, and it has a simple cause. An update was interrupted before WordPress could delete the .maintenance file. The interruption could be a server timeout, a closed browser tab, a PHP memory limit hit, or a plugin conflict that crashed the update process.

The fix takes 30 seconds:

  1. Connect to your site via SFTP or your hosting control panel’s file manager
  2. Navigate to the WordPress root directory (where wp-config.php lives)
  3. Enable “show hidden files” if you do not see the .maintenance file
  4. Delete the .maintenance file
  5. Load your site in a fresh browser tab to confirm it is back

If the site comes back but something looks broken, the update that was interrupted likely only partially completed. Check your plugins page for any that show “update failed” and try the update again.

If a plugin update broke the site entirely, you will want a recent backup to restore from. This is exactly why taking a snapshot before every batch of updates matters. For a full breakdown of what a proper update workflow looks like, see our wordpress maintenance checklist.

Common Mistakes That Cause Maintenance Mode Problems

I have fixed enough stuck-in-maintenance issues to spot patterns. These five mistakes cause most of the problems:

Updating everything at once. Clicking “Update All” on 15 plugins simultaneously increases the chance of a timeout or memory limit hit, which leaves the .maintenance file behind. Update in batches of 3-5 plugins and let each batch finish before starting the next.

Closing the browser during updates. WordPress updates run server-side, so closing your browser should not interrupt them. But some hosting environments tie PHP processes to the browser session.

If the connection drops, the process dies mid-update. Keep the tab open until you see “All updates have been completed.”

Insufficient PHP memory. WordPress needs enough memory to download, extract, and install updates. If your WP_MEMORY_LIMIT is set to 64MB (the old default) and you are updating a large plugin, the process can fail silently. Set it to at least 256MB in wp-config.php:

define( 'WP_MEMORY_LIMIT', '256M' );

Server timeout limits. Shared hosting often sets max_execution_time to 30 seconds. A large plugin update that takes 45 seconds gets killed, leaving .maintenance behind. Your host can increase this, or you can add set_time_limit(300) to your wp-config.php temporarily.

Not having rollback capability. When an update fails and leaves your site stuck, you need a way to restore the previous state. Without a pre-update snapshot, you are stuck debugging a half-updated site.

We use snapshot-protected updates on every client site specifically because update failures are not rare, they are expected over time. If you want to understand the real cost of not having this safety net, our why wordpress maintenance matters post breaks down the math.

Plugin vs. Code: Which Method Should You Pick?

The right method depends on how often you need maintenance mode and who needs to control it.

Use the .maintenance file or WP-CLI when you are doing a one-time operation on a site you manage via SSH. Fast to enable, fast to remove, no plugins to install. The 10-minute auto-expiry on WP-CLI is actually helpful here since it prevents you from accidentally leaving the site down.

Use the functions.php snippet when you are a developer who needs admin access during maintenance. This is my go-to for client work where I need to make changes in wp-admin while keeping visitors away. Just remember to remove the code when you are done.

Use a plugin when non-technical team members need to toggle maintenance mode, when you want a designed maintenance page, or when you run a membership or ecommerce site that needs role-based bypass. The overhead of one lightweight plugin is worth it if maintenance mode is a regular part of your workflow.

Use the maintenance.php drop-in when you want a custom-designed maintenance page without a plugin dependency. One file, no database load, works with any method that creates the .maintenance file.

For most business sites, the real answer is that you should rarely need to think about maintenance mode at all. A proper update workflow, pre-update snapshots, instant rollback, and post-update monitoring, makes manual maintenance mode unnecessary for routine work. You only need it for major structural changes.

How Does Maintenance Mode Affect SEO?

The 503 status code is the key detail. When WordPress returns a 503 with a Retry-After header, Google and other search engines treat it as a temporary outage.

They will come back later and re-crawl the page. Your rankings stay intact.

The problem starts when maintenance mode stays active too long. If a crawler hits your site multiple times over several hours and keeps getting 503 responses, it may start treating those pages as genuinely unavailable. There is no published threshold, but keeping maintenance windows under 30 minutes is a safe practice.

Two things that will hurt SEO during maintenance:

  • Returning a 200 status code instead of 503. Some poorly coded maintenance plugins return a 200 with a maintenance message, which tells search engines “this is the actual page content.” Your real content gets de-indexed and replaced with “under maintenance” in search results.
  • Leaving maintenance mode on for days. This signals to crawlers that your site is down, not temporarily unavailable.

If you are planning extended maintenance that will take more than an hour, configure your maintenance page to return a 503 with a realistic Retry-After value. Most plugins handle this correctly. The manual .maintenance file method also returns 503 by default through WordPress core.

Your Next Step

Pick the method that matches your technical comfort and the situation. For a quick one-off change, create the .maintenance file manually or run wp maintenance-mode activate. For anything involving a designed page or team access, use a plugin. For a developer-controlled toggle, drop the functions.php snippet in.

Whatever method you choose, the two non-negotiable steps are: take a full snapshot before you start, and verify the site is out of maintenance mode when you finish. Those two habits prevent most of the wordpress maintenance tips emergencies I see, the stuck sites, the half-applied updates, the “I forgot it was still in maintenance mode” tickets that come in on Monday morning.

Frequently Asked Questions

Prefer someone else handle the downtime risk?

Our plans include snapshot-protected updates with instant rollback, so your visitors never see a maintenance screen.