Maintaining a WordPress website involves many tasks. There are small tweaks, like updating a plugin, finding and fixing broken links, and deleting spam comments, which don’t require any downtime. But there are larger fixes, like redesigning your website or switching servers, which do require downtime.

In that case, you can put your site into maintenance mode. This is a great way to tell visitors that your website is under maintenance and what timeline they can expect, so you can make major changes with as little interruption to the visitor experience as possible.

Let’s take a look at the different ways you can put WordPress in maintenance mode below.

Grow Your Business With HubSpot's Tools for WordPress Websites

Below we’ll walk through the processes of putting WordPress maintenance mode manually and with a plugin, step-by-step.

How to Put WordPress in Maintenance Mode Manually

If you have some technical experience and are comfortable editing your theme files, then you can put WordPress in maintenance mode manually. Here are the steps:

For short-term downtime (less than an hour or so), you might not want to go through the trouble of setting up a custom maintenance mode page.

In that case, you can use WordPress’s default maintenance mode page to let visitors know you’ll be right back.

1. Click Appearance > Theme Editor in your WordPress dashboard.

How to Put WordPress in Maintenance Mode Manually: click appearance > theme editor

2. Click the Theme Functions, or function.php file.

How to Put WordPress in Maintenance Mode Manually: click theme functions file

3. Copy all the code in the existing file and paste it into a new file, and save a copy to your desktop. This will be your backup.

4. In the theme editor, scroll to the bottom of the functions.php file and copy and paste the following code snippet:

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');

5. Click the Update File button.

How to Put WordPress in Maintenance Mode Manually: click update file after adding the code snippet

6. Now visit your site in a new browser window to ensure it’s in maintenance mode. Here’s how the default maintenance mode page looks:

default WordPress maintenance mode message says "Under maintenance"

You’ll notice the default maintenance mode page is rather austere. If your site will only be under maintenance for an hour or two, then that’s fine. But for a longer maintenance period, you might want to use a plugin to easily create and customize a maintenance mode page. Let’s cover that process below.

How to Put WordPress in Maintenance Mode with a Plugin

If you’re not comfortable with editing your theme files, then you can use a plugin. There are several WordPress maintenance mode plugins to choose from. Below we’ll walk through the process using the free WP Maintenance Mode plugin, specifically, but it will be similar no matter what plugin you use.

1. Install and activate the WP Maintenance Mode plugin.

How to Put WordPress in Maintenance Mode with a Plugin: install WP Maintenance Mode

2. Go to Settings > WP Maintenance Mode.

How to Put WordPress in Maintenance Mode with a Plugin: click settings > WP Maintenance mode

3. Click on the Design tab to customize the maintenance mode page that will appear to users when visiting your site when it’s under maintenance. Scroll to the bottom and click Save Settings.

How to Put WordPress in Maintenance Mode with a Plugin: configure design tab of WP Maintenance mode plugin

4. Click on the Modules tab to add a countdown timer, email opt-in form, social media links, and a Google Analytics tracking code to your maintenance mode site. Scroll to the bottom and click Save Settings.

How to Put WordPress in Maintenance Mode with a Plugin: configure Modules tab of WP maintenance mode plugin

5. Click on the Manage Bot and GDPR tabs if you’d like to set up a chatbot and add links to your privacy policy on your maintenance mode site. Scroll to the bottom and click Save Settings.

6. When you’re ready, click on the General Tab and switch the status to Activated. Scroll to the bottom and click Save Settings.

How to Put WordPress in Maintenance Mode with a Plugin: switch status to activated in general tab of WP Maintenance Mode plugin

7. Now visit your site in a new browser window to ensure it’s in maintenance mode. Here’s how a default maintenance mode site built with the WP Maintenance Mode plugin looks:

default WordPress maintenance mode page of WP Maintenance Mode plugin

If you’re not satisfied with the customization options of WP Maintenance mode, then you can try a plugin like SeedProd. SeedProd provides several maintenance mode templates that you can customize to create a maintenance mode page that aligns with your branding. Here’s an example:

WordPress Maintenance mode example built using SeedProd plugin

Image Source

If you’re already using Elementor, or would prefer to use that page builder instead of WP Maintenance Mode for another reason, then check out How to Create a Maintenance Mode Site With Elementor.

Disabling WordPress Maintenance Mode

Once you complete your updates and maintenance tasks, you’ll want to disable maintenance mode. The process is easy, no matter how you enabled this mode.

If you manually put your site in maintenance mode, then you simply have to navigate back to the functions.php file and remove the code you added. Once you remove that snippet (and only that), save the file. Then visit your site in a new browser window to ensure it’s live and no longer in maintenance mode.

If you used a plugin to turn on maintenance mode, then the process to disable it is even simpler. The steps below are for the WP Maintenance Mode plugin specifically, but the process will be similar no matter what maintenance mode plugin you used.

1. Log in to your WordPress dashboard.

2. Click Settings > WP Maintenance Mode.

3. By default, the General tab should be open. If not, click on it.

4. Switch the status to Deactivated.

5. Click the Save Settings button.

Don’t forget to visit your site in a new browser window to ensure it’s live and no longer in maintenance mode.

WordPress Maintenance Mode Not Working

If you’ve followed one of the processes above and WordPress maintenance mode is not working, then there’s two probable causes.

One is that your browser cache hasn’t been cleared so the maintenance mode page is not displaying when visitors first land on your site, or at all.

Another is that the .maintenance file hasn’t been deleted so your site is stuck in maintenance mode. Both have relatively easy solutions.

Let’s take a closer look at each of them.

Solution 1: Clear Browser Cache.

If maintenance mode is not working, it’s possible that visitors are being served the cached version of your site — ie. static copies of your site’s files stored in a temporary storage location. This might not reflect recent updates or changes to your site, like turning on maintenance mode. In that case, you’ll need to clear your cache.

Thankfully, clearing your browser cache in WordPress is easy thanks to WordPress caching plugins like WP Rocket.

For example, if you’ve installed and activated WP Rocket, then you’d simply click Settings > WP Rocket. In the WP Rocket Dashboard, locate Quick Actions and click the Clear Cache button.

clear cache in WP Rocket plugin settigns page to troubleshoot WordPress Maintenance Mode Not Working

Image Source

Alternatively, your hosting provider might provide a simple way to clear your cache directly in your WordPress dashboard. For example, WP Engine offers Clear All Caches as a quick action in its plugin tab in the admin dashboard.

Click clear cache in WP Engine plugin page to troubleshoot WordPress Maintenance Mode Not Working

Image Source

 

SiteGround and LiquidWeb offer similarly easy options to clear your cache in a few clicks.  

Solution 2: Delete the .Maintenance File.

If your WordPress site is stuck in maintenance mode, then you need to delete the .maintenance file to return your site back to normal. To do, follow the steps below.

1. Log in to your site via an FTP client.

2. Click the public_html folder.

3. Click the wp-config.php file.

4. Find the .maintenance file, and right click to delete it.

Delete maintenance file in FTP client to troubleshoot WordPress Maintenance Mode Not Working

Image Source

If you can’t find the .maintenance file, then check the option to show hidden files in your FTP client. For example, in Filezilla, you’d click Server > Force showing hidden files.

force showing hidden files in FTP client if can't located maintenance file

Image Source

5. Now visit your site in a new browser window to ensure it’s no longer in maintenance mode.

Turning on WordPress Maintenance Mode

To inform visitors that your website is currently under maintenance, you can put WordPress in maintenance mode. Whether you choose to do so manually or with a plugin will depend on the updates you’re making, the timeline you expect, and what steps you’re encouraging visitors to take in the meantime (like sign up for email notifications or visit your social media pages).

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

 Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Nov 19, 2021 7:00:00 AM, updated November 19 2021

Topics:

WordPress Website