What is maintenance mode?
Maintenance mode is like a "closed for cleaning" sign on a shop door. Visitors see a short message instead of a half-finished site. You can still log in and work. It is a good idea when you update, change the design or fix a problem.
WordPress also turns on a short maintenance mode by itself during updates. If it gets stuck, see the last section.
Method 1: Use a plugin
A plugin is a small add-on program for WordPress. This is the easiest way and lets you make a nice page.
- Log in to your WordPress dashboard.
- Click Plugins, then Add New.
- Search for "maintenance mode" or "coming soon".
- Pick a plugin with good reviews and many users.
- Click Install Now, then Activate.
- Open the plugin's settings.
- Write a short message, such as "We are updating. Back soon."
- Switch maintenance mode On.
- Save.
Open your site in a private browser window to check it. You should see the message.
Method 2: Use code
- Open the
functions.phpfile of your child theme. - Add this code at the bottom.
- Save the file.
function hv_maintenance_mode() {
if (!current_user_can('manage_options')) {
wp_die('We are updating our site. Please come back soon.', 'Maintenance', array('response' => 503));
}
}
add_action('get_header', 'hv_maintenance_mode');
This shows the message to everyone except administrators. The code 503 tells search engines the stop is only for a short time.
Turn it off
- Switch the plugin to Off, or remove the code.
- Open your site in a private window and check that it works.
If WordPress is stuck in maintenance mode
Sometimes an update stops half-way. The site shows "Briefly unavailable for scheduled maintenance". WordPress makes a file named .maintenance in your site folder. Delete it.
- Open the File Manager in your hosting control panel.
- Open the folder where WordPress lives, often
public_html. - Turn on Show Hidden Files, since the name starts with a dot.
- Delete the
.maintenancefile.
Quick recap
- Maintenance mode shows a "back soon" page to visitors.
- A plugin is the easiest way.
- Remember to turn it off when you finish.
- Delete
.maintenanceif an update gets stuck.