Get a Free Quote

WordPress Maintenance Mode: How to Turn It On (and Off) Safely

Maintenance mode shows visitors a short holding page while you work on a WordPress site, instead of a half-finished layout or an error. WordPress has a built-in version that runs during updates, and there are plugin and code options for longer jobs. This guide covers all three, the one mistake that gets a site stuck, and how to keep search engines happy while the site is down.

What maintenance mode is

Maintenance mode is a state where WordPress shows every visitor a temporary page instead of the real site, while logged-in administrators can still see and work on it. WordPress itself uses a simple version of this every time it updates core, a theme or a plugin: it creates a file called .maintenance in the site's root folder, shows the message "Briefly unavailable for scheduled maintenance. Check back in a minute.", and deletes the file when the update finishes.

That built-in page is plain and unbranded, which is fine for a thirty-second update. For anything longer, such as a redesign, a plugin migration or a database clean-up, you want a page that looks like your brand, tells people when to come back, and sends the right signal to search engines.

When to use it, and when not to

Use maintenance mode for short, planned work on the live site that visitors would otherwise see in a broken state. Do not use it for a rebuild that will take days or weeks; for that, work on a staging copy and keep the live site running.

Good reasons to switch it on:

  • Updating a batch of plugins on a site with no staging environment.
  • Switching themes or making layout changes that briefly break pages.
  • Moving hosts or changing the domain, during the final cut-over.
  • Recovering from a problem and needing a calm minute to fix it.

Bad reasons:

  • A redesign that will take more than a few hours. Build it on a staging site and swap it in when it is ready.
  • A new site that is "coming soon" for months. That is a launch page, not maintenance, and it needs different handling for search engines.
Thinking about a new WordPress website?Get a free consultation and a fixed-scope quote. A senior engineer replies within 24 hours. No obligation.
Get a Free Quote

Three ways to turn it on

There are three ways to put WordPress into maintenance mode: a plugin, a short piece of code, or the .maintenance file WordPress already understands. Pick based on how long the site will be down and how much control you need.

MethodBest forBranded pageSends 503 statusEffort
PluginNon-technical users, longer planned workYes, with a visual editorUsually, check the settingsLow
Code snippetDevelopers, sites with few pluginsYes, you write itYes, you control itMedium
.maintenance fileQuick manual updates, emergenciesOnly with a custom maintenance.phpYesLow, but expires after ten minutes

Method 1: a maintenance mode plugin

A maintenance mode plugin is the easiest option and the right one for most site owners. Install one from the WordPress plugin directory, design the holding page, choose who can bypass it (usually administrators and editors), and switch it on. The better plugins let you set the HTTP status to 503, add a countdown or a contact link, and whitelist your own IP address so you can test the site as a visitor would see it.

Before you rely on a plugin, check three settings: that logged-in users are excluded, that the page returns a 503 status rather than a 200, and that the plugin does not add a "noindex" tag to your whole site. Some "coming soon" plugins do the last one by default, and it is the wrong choice for a live site with rankings.

Method 2: a few lines of code

If you would rather not add a plugin, a short function in a site-specific plugin or the child theme's functions.php does the same job. This example shows the holding message to everyone who is not logged in, returns a 503 status, and tells search engines to retry in an hour:

add_action('template_redirect', function () {
    if (current_user_can('manage_options') || is_user_logged_in()) {
        return;
    }
    wp_die(
        '<h1>We are doing some maintenance</h1><p>The site will be back shortly. Email us if it is urgent.</p>',
        'Site under maintenance',
        array('response' => 503)
    );
});
add_action('send_headers', function () {
    if (!is_user_logged_in()) {
        header('Retry-After: 3600');
    }
});

Put the code in a child theme or a small custom plugin, never in the parent theme, or a theme update will remove it. To turn maintenance mode off, remove or comment out the code. Keep a note of where it lives, because six months later nobody remembers.

Ready to bring your WordPress project to life?Get a free consultation and a fixed-scope quote. A senior engineer replies within 24 hours. No obligation.
Get a Free Quote

Method 3: the .maintenance file

The .maintenance file is the mechanism WordPress uses itself, and you can trigger it by hand. Using your host's file manager or SFTP, create a file named .maintenance in the same folder as wp-config.php with this single line:

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

Every visitor, including you, will now see the default maintenance message. Two things to know: WordPress ignores the file once its timestamp is more than ten minutes old, so this method only works for short jobs, and it blocks administrators too. To customise the message, create wp-content/maintenance.php with your own HTML and WordPress will show that file instead of the default text. Delete .maintenance when you are done.

Fixing a site stuck in maintenance mode

If your site says "Briefly unavailable for scheduled maintenance" long after an update finished, the fix is to delete the .maintenance file from the site's root folder. This happens when an update is interrupted, most often by a timeout, a closed browser tab or a host that ran out of memory, so WordPress never got to remove the file.

  1. Open your hosting file manager or connect with SFTP.
  2. Go to the folder that contains wp-config.php. Turn on "show hidden files" if you do not see the file, because names beginning with a dot are hidden by default.
  3. Delete .maintenance.
  4. Reload the site. If it loads, go to Dashboard, then Updates, and check whether the interrupted update needs to be run again.

If the site still will not load after the file is gone, the interrupted update may have left a plugin or theme half-installed. Rename that plugin's folder inside wp-content/plugins to disable it, then reinstall it from the dashboard. If you see a blank page instead of a message, follow our guide to the WordPress white screen of death.

Maintenance mode and SEO

Maintenance mode does not hurt your rankings if the holding page returns an HTTP 503 status and the downtime is short. A 503 tells search engines the outage is temporary, so they keep your pages in the index and come back later. The two things that do cause damage are returning a 200 status with a placeholder page, which search engines may index as your new content, and staying down for days, which can lead to pages being dropped.

  • Always return 503, and add a Retry-After header if you can.
  • Keep the outage as short as possible. For anything over a day, use staging instead.
  • Do not add a site-wide noindex tag. It is not needed with a 503 and it takes time to undo.
  • Make sure the holding page is served on every URL, not just the home page, so deep links behave consistently.
  • After you switch it off, load a few key pages and confirm they return 200 again.
Want a clear plan and price for your website?Get a free consultation and a fixed-scope quote. A senior engineer replies within 24 hours. No obligation.
Get a Free Quote

Checklist before you switch it on

  • Take a fresh backup and confirm you can download it. Our guide to backing up WordPress covers what a complete backup includes.
  • Decide who needs to bypass the page and confirm they are logged in.
  • Write a plain message with an expected return time and a way to contact you.
  • Confirm the page returns a 503 status. A free HTTP header checker will show it.
  • Tell colleagues who handle the phones or social accounts that the site will be down.
  • Note exactly how to turn it off, and who is responsible for doing so.
  • When finished, check the home page, a product or service page, the contact form and checkout if you have one.

Next step

If you find yourself switching maintenance mode on every few weeks, the underlying problem is usually that updates are being run on the live site without a staging copy or a backup routine. A maintenance plan fixes that: updates are tested on staging, backups run automatically, and visitors never see a holding page. Read what WordPress maintenance costs, see our WordPress maintenance and support service, or ask a question on the contact page.

Site stuck or updates going wrong? Send us the site address and what happened. A senior developer replies within 24 hours.
Hamza Hai

Hamza Hai writes about WordPress development, performance and growth for Canadian businesses.

FAQ

Frequently asked questions

A few hours is safe if the page returns a 503 status. Beyond a day, search engines may start dropping pages, and customers lose patience. Longer work belongs on a staging site.

Plugins and code snippets normally let logged-in administrators through, so if you are locked out you are probably not logged in, or you used the .maintenance file, which blocks everyone. Delete the file or log in on a second browser.

It depends on the method. A plugin usually lets you choose which roles bypass the page. Test with a customer account before you switch it on for real.

No. A coming soon page is for a site that has not launched and is often set to noindex. Maintenance mode is for a live site that is briefly down and should return a 503 so rankings are kept.

Have a project?

Let's Build Your Next WordPress Website

Get a free consultation and a fixed-scope quote. No obligations.

  • Free Consultation
  • No Hidden Costs
  • 100% Confidential

Request your free quote

Tell us what you are building. A senior engineer replies within 24 hours.

Please enter your name.

Please enter a valid email address.

Please tell us a little more about your project (10+ characters).

No obligation. Your details are only used to prepare your quote.