How to Put Your WordPress Site in Maintenance Mode

Do you know how to put your WordPress site into maintenance mode? There are times when every website and blog needs working on. It could be to test new features, debug errors, and update or fix template code, etc. A few years ago, work in the backend could break the site at the front. Visitors would quickly hit the back button, and some would never return.

WordPress Default Maintenance Message

WordPress automatically puts your website into maintenance mode during a core update. New releases don’t usually take long to install, which is just as well. The default message is plain and uncaring and does nothing to encourage the visitor to return.

You could say it’s practical and to the point, but it doesn’t impress the visitor.

Broken Website, Broken Reputation

Web surfers are not as patient as they used to be, nor as loyal. They demand attractive, fast-loading webpages, easy navigation, and a smooth user experience. Few will bookmark a site that doesn’t check the above boxes. And no one’s going to hang around a broken website not knowing when it’s going to be back up again. Fortunately, there’s a softer, less damaging approach.

How Maintenance Mode Works

Custom maintenance messages display friendly webpages that informs visitors of the site status. That’s much better than arriving at a broken website with a single line of text. You can apologise for the temporary inconvenience and say how long you expect the site to be down. Impressions do matter. It’s why an aesthetically-pleasing maintenance splash page is so important.

Site Under Maintenance Options

There are three ways to control what the visitor sees for a site in maintenance mode.

  1. Use a WordPress plugin to enable maintenance mode quickly
  2. Add code to the .htaccess file
  3. Edit the WordPress functions.php file

The plugins approach is by far the easiest and most versatile option, so let’s start with that.

#1 Use the SeedProd WordPress plugin

A plugin is the easiest and most flexible way to create a custom Under Maintenance page. There are several available, so explore all your options. For this example, we’ll look at a popular product from SeedProd

The SeedProd Lite plugin offers three customised pages for the following:

  1. Site Maintenance Mode
  2. Under Construction
  3. Coming Soon

Log in to your WP Dashboard and click Plugins -> Add New from the side menu.

You’re now at the Add Plugins screen.

  1. Type seedprod into the plugin’s search box
  2. Check that SeedProd is compatible with your version of WordPress
  3. Click Install Now. Click again when the button text changes to Activate

You’re now at the SeedProd Lite plugin page where you can make custom pages. The create options are self-explanatory and simple to use.

SeedProd Lite offers the following customisable settings for maintenance page creation:

  • Add a custom logo to your design
  • Add a custom headline
  • Add a custom message
  • Add media to the page
  • Add SEO Title, Description, and Analytics Code
  • Enable/Disable the custom page with a single click as and when needed

You can also add contact and social sharing links to the page for your visitor’s convenience.

SeedProd Pro (premium version)

There’s a premium version of this plugin called SeedProd Pro. The pro version has more controls, widgets, pre-made WordPress themes (templates), lots of stock images, and other features. SeedProd also tells search engines like Google that the site is only temporarily down.

#2 Add code to the .htaccess file using FTP

This method lets you temporarily display a custom maintenance page without using a plugin.

For this approach, you should have already prepared a custom ‘site under maintenance’ html file. You also know how to use an FTP client like FileZilla.

PLEASE MAKE A LOCAL BACKUP OF YOUR .htaccess FILE BEFORE PROCEEDING.

Adding a code snippet to the .htaccess file is simple, but you must be careful. You won’t have access to any part of your site afterwards, including the WP Dashboard. That’s because all attempts to open the website will redirect to your maintenance.html file.

Open your FTP software and locate the .htacess file under the public_html folder.

Rename the file to .htaccess_default

Open a text (txt) program like Notepad, then copy and paste the following code into it:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance.html$
RewriteRule ^(.*)$ https://example.com/maintenance.html [R=307,L]

Replace https://example.com/maintenance.html with your site’s URL.

Click File -> Save As… and type .htaccess

Upload the new .htaccess file to your public_html folder.

When maintenance is finished, rename the new .htaccess file to .htaccess_maintenance

Now remove _default from the original file to restore it.

#3 Edit the functions.php file

The third way to display a custom site maintenance page is to edit the WP functions.php file. This approach lets you customise the WordPress default maintenance page.

PLEASE MAKE A LOCAL BACKUP OF YOUR functions.php FILE BEFORE YOU PROCEED.

Log in to your WordPress Dashboard.

From the side menu, go to Appearance -> Theme Editor.

You may get a warning message like the one below.

Click the I Understand button to continue.

Select the functions.php link to the right of the screen to open the file.

Click anywhere inside the functions.php window. Hold down the keyboard’s CTRL key and tap the End key. This shortcut puts the cursor at the end of the file.

Now Copy & Paste this code into the functions.php file.

// Activate WordPress Maintenance Mode
function wp_maintenance_mode() {
if (!current_user_can(‘edit_themes’) || !is_user_logged_in()) {
wp_die(‘<h1>Under Maintenance</h1><br />Website under planned maintenance. Please check back later.’);
}
}
add_action(‘get_header’, ‘wp_maintenance_mode’);

Change the bold message text below to whatever you want.

‘<h1>Under Maintenance</h1><br />Website under planned maintenance. Please check back later.’

Click the Update File button (bottom left).

You now know how to apply a visitor-friendly site maintenance notification to your WordPress website. Plugins are the recommended route, but you have other options if you need them.

Want to Learn WordPress?

WordPress is an amazing platform for building any type of website.   It’s used by large corporations and small mom & pop sites.

You may also like

Comments

Leave a Comment

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

Hello, I'm
Andy Williams!

You can get up to 90% off my Online Courses for webmasters, marketers & affiliates (plus a free course on Gutenberg).

Create your own WordPress Theme

It's built in to WordPress using Gutenberg, and my new course shows you how.