Under Construction Thumbnail

How to Disable / Maintenance Mode Your Website on WordPress

When you need to update, redesign, or repair a live WordPress site, visitors should not see a broken or half-finished page. A maintenance screen can hide the public site for a short time. Make a backup first, and use a staging copy when you can, so you have a way back if something goes wrong.

Important: WordPress core does not provide a WP_MAINTENANCE_MODE constant in wp-config.php. Adding define( 'WP_MAINTENANCE_MODE', true ); does nothing by itself and will not show a maintenance page. If you added that line after older advice, you can safely remove it.

How to put a WordPress site into maintenance mode

WordPress does have a real, automatic maintenance mode during updates, but that mode is only temporary. For planned work that lasts longer than a few minutes, use a maintained plugin from WordPress.org, or—if you cannot use a plugin—a short, removable snippet in a child theme.

1. Recommended: use a maintenance-mode plugin

The simplest beginner-friendly approach is a plugin from the official WordPress plugin directory. Two long-standing options are Maintenance by WebFactory and LightStart by Themeisle (this plugin was formerly called WP Maintenance Mode). Review the current listing before you install, and follow that plugin’s own settings screen—button names can change between versions.

Typical steps, based on those plugins’ WordPress.org installation notes:

  1. Back up the site, and test on staging when possible.
  2. Stay logged in as an administrator. In wp-admin, go to Plugins → Add New, search for the plugin by name, then install and activate it.
  3. Open the plugin’s settings page. Maintenance adds an item in the main admin menu; LightStart uses a Settings page. Customize the public message with the controls the plugin provides.
  4. Enable maintenance mode only when you are ready. LightStart’s plugin listing notes that activating the plugin can place the site in maintenance mode right away, while users with sufficient rights still see the front end.
  5. When the work is finished, turn maintenance off in the plugin settings, purge any page cache, and view the site in a private/incognito window while logged out to confirm the public pages are back. Only then deactivate the plugin if you no longer need it.

LightStart’s FAQ warns that cache plugins can serve stale pages during maintenance. If a cache plugin stays active, delete its cache after you enable or disable maintenance mode.

The Maintenance plugin can send an HTTP 503 (“Service temporarily unavailable”) response so search engines treat the downtime as temporary. Keep that window short. A long 503 can still affect how the site is crawled.

2. What WordPress itself does during updates

When WordPress updates core, a theme, or a plugin, it temporarily creates a .maintenance file in the WordPress root. That file stores a timestamp in a $upgrading variable. Core then treats the site as being in maintenance mode only while that timestamp is less than about 10 minutes old. After roughly 10 minutes, WordPress considers maintenance finished even if the file is still there.

During that short window, WordPress sends HTTP 503 with a Retry-After: 600 header and shows the message “Briefly unavailable for scheduled maintenance. Check back in a minute.” You can replace that brief screen with an optional drop-in file named maintenance.php inside wp-content, but the drop-in applies only while core maintenance mode is actually active.

Do not create a static .maintenance file yourself as a lasting “closed for maintenance” switch. It is not a durable manual control: after about 10 minutes visitors see the live site again, and a leftover file after a failed update can leave a confusing message until you delete it. If the maintenance screen gets stuck after an update, connect by FTP or your host’s file manager and delete .maintenance from the WordPress root.

WordPress documents this in wp_is_maintenance_mode(), wp_maintenance(), the notes on a stuck maintenance screen in common WordPress errors, and Updating WordPress.

3. Optional: a temporary snippet in a child theme

If you cannot use a plugin, add the following to a child theme’s functions.php—not a parent theme that updates will overwrite. The template_redirect hook runs on the public site only, so wp-admin and the login screen stay available. Logged-in users who can manage options still see the site. Everyone else receives HTTP 503 and a Retry-After header, matching the pattern WordPress core uses during updates. Remove the snippet to restore the public site.

add_action( 'template_redirect', function () {
    if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
        return;
    }

    header( 'Retry-After: 3600' );
    wp_die(
        'This site is temporarily unavailable for scheduled maintenance. Please check back soon.',
        'Maintenance',
        array( 'response' => 503 )
    );
} );

Use this only as a short, temporary measure, and try it on staging first. After you remove the code, purge caches and confirm the public site loads again while you are logged out. Do not leave a 503 response in place longer than needed.

Conclusion

To hide a WordPress site during planned work, use a maintained maintenance plugin, turn it off when you are done, and verify the public pages. WordPress’s own .maintenance file is only a short, automatic shield during updates—about 10 minutes—not a lasting manual switch, and there is no WP_MAINTENANCE_MODE line to add in wp-config.php. Back up first, keep downtime short, then restore and check the live site.

Leave a Comment

Your email address will not be published. Required fields are marked *