The built-in WordPress maintenance page is not user friendly. There’s no button to turn it off or on, and there’s no GUI to modify it. It’s created in a way so that users don’t know it exists. Yet, it still manages to cause problems, and sites get stuck in maintenance mode (with no clear solution on how to fix) showing only the maintenance page with no access to WP admin. The situation is not that bleak if you know what to do. The default maintenance page can easily be disabled, enabled, and modified.

Briefly unavailable for scheduled maintenance. Check back in a minute.
That’s the default maintenance message in WordPress that sites get stuck with. Don’t worry; it can be removed and modified.

I’ve never seen this maintenance page. Where is it?

Correct, you probably never saw it because the only time when it’s enabled is the time when WP is doing updates, and you’re in WP admin at that time doing updates so you won’t see it.

That’s the way the maintenance page works. On 99% of sites, it gets turned on for a second or two at most. As you can see by the screenshot below, it doesn’t look stellar.

Default WordPress Maintenance Page
The default WordPress Maintenance Page is just a box on gray background with one sentence

Do I need a maintenance page?

You do need it! Whenever your site is not fully functional (for whatever reason), it should show the maintenance mode page. A simple page that explains to users and Google that the site is briefly offline. It’s a vast improvement over opening a broken site or one that’s not accessible at all.

WordPress uses the maintenance page (or maintenance mode as some call it) in situations when it’s copying new files (for core, plugin, or theme updates) or updating the database. Since some files and the database are not available to users at that moment, the maintenance page must be completely independent of any WordPress files or the database. It has to be a plain static HTML file or a simple PHP one that doesn’t use any WP functions.

If you want to learn more about how the maintenance page is implemented in WordPress core and how it’s turned on and off check out the wp-includes/load.php file on WP’s Git from line #232.

How to enable the default WordPress maintenance page

As we already mentioned, there’s no on or off button for it, so you’ll have to create one new file via FTP. You can also use the file browser in cPanel or any other hosting control panel.

Once you connect to your site via FTP head over to the WordPress root folder, the one where wp-config.php is located. Create a new file named .maintenance. Don’t forget the dot as the first character in the name. Then put these 2 lines of PHP in that file:

<?php
  $upgrading = time();

That’s it. Any frontend or admin page you open now shows the maintenance page with the default “Briefly unavailable for scheduled maintenance. Check back in a minute.” message. It will remain active for as long as the .maintenance file with that content is in your root WP folder.

If you’re stuck with the maintenance page, there’s an easy fix to remove it

Disabling the maintenance page is easy. All you need to do is delete or rename the .maintenance file. Or wait for 15 minutes. After 15 minutes, the maintenance page goes away on its own. It’s a fallback feature WordPress added.

Since you don’t have access to WordPress admin when maintenance is enabled, use FTP (or cPanel file browser) to find the .maintenance file in your root WP folder and delete it. That will disable the maintenance page. There’s no other way to do it.

How to modify the maintenance page

As already mentioned, while WordPress (or any other site) is in maintenance mode, it’s assumed that not all of its resources are available, such as the database. Therefore the maintenance page has to be simple. Preferably a static HTML file or a PHP one with a minimum amount of code.

Creating a maintenance.php file in the wp-content folder will replace the default maintenance page. You can put anything in that file. For a start, just put “hello world” and see if it works. You need to enable the maintenance mode first using the .maintenance file, as described above.

Simple maintenance page
With a bit of code you can have a great looking maintenance page

I hate editing files! Is there a plugin to handle this?

At the moment there’s only one plugin on the market that controls the default WordPress maintenance page – the Coming Soon & Maintenance Mode. It offers everything you need to handle coming soon and maintenance mode pages. Among other things, it controls the maintenance.php file, so you don’t have to edit it manually. It also comes with 150+ coming soon templates and a whole set of options to manage them. It’s very user friendly and used on over 100,000 sites.

Simple maintenance page template

If you still want to do things on your own, we’ve prepared a simple maintenance page template for you. Just copy/paste the code below into the maintenance.php file, and you’ll have a great looking page. You’ll need to modify the title, text a bit, and the links we put in.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir='ltr'>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width">
    <title>Site is offline for scheduled maintenance</title>
    <style type="text/css">
      html {
        background: #f1f1f1;
      }
      body {
        background: #fff;
        color: #444;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
        margin: 2em auto;
        padding: 1em 2em;
        max-width: 700px;
        -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
      }
      h1 {
        border-bottom: 1px solid #fe2d2d;
        clear: both;
        color: #666;
        font-size: 24px;
        margin: 30px 0 0 0;
        padding: 0;
        padding-bottom: 7px;
      }
      #error-page {
        margin-top: 50px;
      }
      #error-page p,
      #error-page .wp-die-message {
        font-size: 14px;
        line-height: 1.5;
        margin: 25px 0 20px;
      }
      #error-page code {
        font-family: Consolas, Monaco, monospace;
      }
      ul li {
        margin-bottom: 10px;
        font-size: 14px ;
      }
      a {
        color: #0073aa;
      }
      a:hover,
      a:active {
        color: #00a0d2;
      }
      a:focus {
        color: #124964;
        -webkit-box-shadow:
        0 0 0 1px #5b9dd9,
        0 0 2px 1px rgba(30, 140, 190, 0.8);
        box-shadow:
        0 0 0 1px #5b9dd9,
        0 0 2px 1px rgba(30, 140, 190, 0.8);
        outline: none;
      }
    </style>
  </head>
  <body id="error-page">
    <div class="wp-die-message">
      <h1>The site is offline for scheduled maintenance</h1>
      <p>Hi 👋<br>Our site is briefly unavailable for <b>scheduled maintenance</b>. Planned down-time is under 5 minutes. In case you're still seeing this message long after 5 minutes please <a href="mailto:email@example.com">contact support</a>.
      </p>
      <p>Thank you for your patience!<br>
        <a href="https://www.example.com/" target="_blank">Best Company Ltd</a> Team
      </p>
    </div>
  </body>
</html>

Leave a Reply

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