Create a Custom Maintenance Page (Upgrading Plugins & Themes)

and like us on FB

Whenever WordPress updates its core, or a plugin is updated, your website will go into maintenance mode and display a message that reads: Briefly unavailable for scheduled maintenance. Check back in a minute.

This WP snippet supports an article in our blog, “Redirect WordPress Websites That Are Under Construction”. Read it here.

While the article linked to above details how to create longer-term and more complex redirects, all you have to do to alter WordPress’ generic message is follow two simple steps.

Step 1

Upload a file called .maintenance to your WordPress root (the same location as index.php). Note that the file has a dot before maintenance – not unlike your .htaccess file. Inside of the file, copy the following:

Because WordPress has a 10-minute expiry on the file, using the current time ensures that it will remain valid. Of course, you could use a specific timestamp if you wanted the site live at a particular moment. WordPress checks for the existence of this file when wp-includes/load.php is called.

Step 2

Upload a file into your wp-contents directory called maintenance.php. This file may contain all your HTML style and other code to your liking.

Further Reading

  • wp_maintenance() in load.php .
  • enable_maintenance_mode filter() on WP.org .
  • wp_maintenance() on WP.org

Considerations

This hack is a permanent solution to an “under construction” page (or until .maintenance is deleted). Many themes now include this file as part of their core code. At some point we’ll likely integrate this feature into one of our own plugins.