
How to put a WordPress site in maintenance mode?
To put a WordPress site in maintenance mode, the easiest option is to install a plugin like SeedProd, LightStart, or Maintenance, turn on maintenance mode in its settings, and customize the message your visitors see. If you prefer not to use a plugin, you can add a short code snippet to your child theme's functions.php file or a custom plugin that shows a maintenance message to everyone except logged-in administrators, or run wp maintenance-mode activate with WP-CLI.
Maintenance mode is useful whenever you're making changes that might temporarily break your site or confuse visitors, such as redesigning your theme, running major updates, or migrating content. In this guide, you'll learn when to use maintenance mode, the difference between maintenance mode and a coming soon page, several ways to enable it, how to keep it SEO-friendly, and how to fix a site that gets stuck in maintenance mode.
What Is Maintenance Mode in WordPress?
Maintenance mode is a temporary state where visitors see a notice, such as "We're making some improvements and will be back shortly," instead of your normal site. Meanwhile, you and other administrators can still log in and work on the site as usual.
WordPress actually has a basic maintenance mode built in. When you update WordPress core, plugins, or themes from the dashboard, WordPress creates a file called .maintenance in your site's root folder. While that file exists, visitors see the message "Briefly unavailable for scheduled maintenance. Check back in a minute." WordPress deletes the file automatically when the update finishes.
That built-in mode is designed for quick updates, not for extended work, and it locks out administrators too. For planned maintenance, you'll want a more controlled approach.
When Should You Use Maintenance Mode?
Maintenance mode is worth turning on when:
- You're redesigning your site: Switching themes or rebuilding templates in the Site Editor can leave pages looking broken while you work.
- You're running major updates: Large plugin updates, such as a big WooCommerce or page builder release, may need testing before visitors see the result.
- You're migrating or restructuring content: Moving hosts, changing permalinks, or importing content can briefly break links and pages.
- You're fixing a serious problem: If something is visibly broken, a maintenance page looks more professional than an error.
- You're running an online store: Pausing checkout while you update payment or shipping settings avoids failed or incorrect orders.
For small changes, a staging site is often a better choice. You make and test changes on a copy of your site, then push them live, and visitors never notice. Many hosts offer one-click staging. Maintenance mode is best when changes must happen on the live site.
Maintenance Mode vs Coming Soon Mode
These two are often confused, but they serve different purposes and should behave differently for search engines:
- Maintenance mode: For an existing site that's temporarily unavailable. It should return an HTTP
503 Service Unavailablestatus, which tells search engines the downtime is temporary and they should come back later without removing your pages from search results. - Coming soon mode: For a new site that hasn't launched yet. It usually returns a normal
200 OKstatus, so search engines can index your coming soon page, and it often includes an email signup form to collect interest before launch.
Most maintenance plugins let you choose between the two. Using coming soon mode on an established site for a long period can hurt your search visibility, so pick the right one.
Method 1: Use a Maintenance Mode Plugin
A plugin is the fastest and most flexible option, especially if you want a nicely designed page.
Popular Maintenance Mode Plugins
- SeedProd: A popular coming soon and maintenance mode plugin with a drag-and-drop page builder and templates. The free version covers the essentials.
- LightStart (formerly WP Maintenance Mode): A free plugin with coming soon and maintenance modes, a page designer, and options for allowing specific user roles.
- Maintenance by WebFactory: A simple, free plugin with a clean default design.
- CMP – Coming Soon & Maintenance: A free plugin with several themes and good control over who can bypass the page.
Step-by-Step With a Plugin
The exact screens vary, but the process is similar for all of them. Here's the general flow:
-
Install the plugin: Go to Plugins > Add New Plugin, search for your chosen plugin, then click Install Now and Activate.
-
Open the plugin settings: Most add a menu item in the dashboard sidebar or under Settings.
-
Choose maintenance mode: Select maintenance mode rather than coming soon mode, so the plugin sends a 503 status code.
-
Design the page: Add your logo, a short message, an expected return time, and optionally links to your social profiles or a contact email.
-
Set access rules: Decide which user roles can see the live site. By default, administrators can. You might add editors or allow specific IP addresses for a client preview.
-
Activate and test: Turn on maintenance mode, then open your site in a private or incognito browser window. You should see the maintenance page there, while your logged-in browser still shows the real site.
-
Turn it off when you're done: Go back to the plugin settings and disable maintenance mode. Then check your site in a private window again.
Many plugins also add a toolbar indicator at the top of the dashboard so you don't forget maintenance mode is on.
Method 2: Enable Maintenance Mode With Code
If you don't want another plugin, a small snippet does the job well. Add it to your child theme's functions.php file or, better, to a small custom plugin, so it keeps working even while you switch themes. Take a backup first.
<?php
/**
* Plugin Name: Sajjad Maintenance Mode
* Description: Shows a maintenance message to visitors while administrators can still use the site.
* Version: 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function sajjad_maintenance_mode() {
// Let administrators (and anyone who can manage options) through.
if ( current_user_can( 'manage_options' ) ) {
return;
}
// Don't block the login page, admin area, cron, or REST API.
if (
is_admin() ||
wp_doing_cron() ||
( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
'wp-login.php' === $GLOBALS['pagenow']
) {
return;
}
header( 'Retry-After: 3600' );
wp_die(
'<h1>' . esc_html__( 'We’ll be right back', 'sajjad' ) . '</h1>' .
'<p>' . esc_html__( 'Our website is undergoing scheduled maintenance. Please check back soon.', 'sajjad' ) . '</p>',
esc_html__( 'Under Maintenance', 'sajjad' ),
array( 'response' => 503 )
);
}
add_action( 'template_redirect', 'sajjad_maintenance_mode' );
A few notes on how this works:
- The
template_redirecthook runs just before WordPress loads the front-end template, so the admin dashboard and login page keep working normally. wp_die()with'response' => 503sends the correct HTTP status code for search engines.- The
Retry-Afterheader tells crawlers roughly when to come back, in seconds. - Logged-in administrators see the normal site, so you can check your work.
To turn maintenance mode off, deactivate the plugin or remove the snippet.
Showing a Custom Maintenance Template
If you want a fully designed page instead of the default wp_die() screen, create a file called maintenance-page.php in your child theme and load it instead:
function sajjad_maintenance_template() {
if ( current_user_can( 'manage_options' ) || is_admin() ) {
return;
}
status_header( 503 );
header( 'Retry-After: 3600' );
nocache_headers();
$template = get_stylesheet_directory() . '/maintenance-page.php';
if ( file_exists( $template ) ) {
include $template;
exit;
}
}
add_action( 'template_redirect', 'sajjad_maintenance_template' );
The maintenance-page.php file can be a simple standalone HTML document:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>Under Maintenance</title>
<style>
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
font-family: system-ui, sans-serif;
background: #f5f5f4;
color: #1c1917;
text-align: center;
padding: 1.5rem;
}
h1 { font-size: 2rem; margin-bottom: 0.5rem; }
</style>
</head>
<body>
<main>
<h1>We'll be back soon</h1>
<p>We're making a few improvements. Thanks for your patience.</p>
</main>
</body>
</html>
The nocache_headers() call is important. It helps prevent your caching plugin or browser from storing the maintenance page and continuing to show it after you're done.
Method 3: Use WP-CLI
If you have SSH access, WP-CLI includes a maintenance mode command that uses WordPress's built-in .maintenance file:
# Turn maintenance mode on
wp maintenance-mode activate
# Check the current status
wp maintenance-mode status
# Turn maintenance mode off
wp maintenance-mode deactivate
This is handy for scripted deployments, but remember that the built-in mode blocks everyone, including administrators, and shows WordPress's plain default message. It's best for short windows, like running a deployment or database migration.
Customizing the Built-In Maintenance Message
If you use the built-in .maintenance mode often, you can customize its message by creating a file called maintenance.php inside the wp-content folder. WordPress will display this file instead of the default text. Make sure it sends a 503 status:
<?php
http_response_code( 503 );
header( 'Retry-After: 600' );
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Briefly Unavailable</title>
</head>
<body>
<h1>Quick update in progress</h1>
<p>We're updating the site. Please refresh in a minute or two.</p>
</body>
</html>
Method 4: Maintenance Mode at the Server or Host Level
Some situations call for blocking the site before WordPress even loads, such as a server migration or database repair.
- Hosting dashboard: Many managed WordPress hosts have a one-click maintenance mode or "site offline" toggle.
- CDN or proxy: Services like Cloudflare can serve a custom page or redirect traffic using rules.
- .htaccess on Apache: You can redirect all visitors except your own IP address to a static page. Replace
203.0.113.10with your real IP address:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^203\.0\.113\.10$
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|webp|svg)$
RewriteRule ^ - [R=503,L]
ErrorDocument 503 /maintenance.html
</IfModule>
Place this at the top of your .htaccess file, above the WordPress rules, and create a maintenance.html file in your site's root folder. Back up .htaccess before editing, and remove the block when you're finished.
Best Practices for Maintenance Mode
Keep it short: Search engines are fine with brief 503 periods, but if your site returns 503 for several days, pages may start to drop from search results. Aim for hours, not days.
Always use a 503 status: A maintenance page that returns 200 can get indexed in place of your real content.
Tell visitors when you'll be back: Even an estimate like "back by 6 PM UTC" builds trust.
Offer a way to reach you: Show a contact email address or link to your social profiles, especially for businesses and stores.
Schedule for low-traffic hours: Check your analytics to find the quietest time of day or week.
Clear caches afterward: Purge your caching plugin, server cache, and CDN once maintenance mode is off, so no one keeps seeing the maintenance page.
Exclude the maintenance page from caching: If your cache stores the maintenance page, visitors may still see it after you've switched it off.
Consider a staging site: For larger projects, doing the work on staging and pushing it live keeps downtime close to zero.
How to Fix a Site Stuck in Maintenance Mode
Sometimes an update gets interrupted, for example if you close your browser or the server times out, and your site stays stuck on "Briefly unavailable for scheduled maintenance. Check back in a minute."
This happens because WordPress didn't get the chance to delete the .maintenance file. Here's how to fix it:
-
Connect to your server: Use your host's File Manager, an FTP/SFTP client like FileZilla, or SSH.
-
Show hidden files: The file starts with a dot, so it's hidden by default. In cPanel's File Manager, open Settings and tick Show Hidden Files (dotfiles). In FileZilla, go to Server > Force showing hidden files.
-
Find the file: Look in the root folder of your WordPress installation, the same folder that contains
wp-config.php. -
Delete
.maintenance: Remove the file, then reload your site.
With SSH or WP-CLI, it's even quicker:
# From your WordPress root folder
rm .maintenance
# Or with WP-CLI
wp maintenance-mode deactivate
After your site is back, go to Dashboard > Updates and check whether the interrupted update actually completed. If a plugin or theme update was cut off halfway, reinstall that plugin or theme to make sure its files aren't incomplete.
If your site is stuck on a plugin's maintenance page instead, log in at /wp-login.php or /wp-admin/ and disable maintenance mode from the plugin settings. If you can't access the dashboard, rename the plugin's folder in wp-content/plugins to deactivate it.
FAQ: WordPress Maintenance Mode
Not if it's brief and returns a 503 status code. Search engines understand 503 as temporary. Problems start when a maintenance page returns a 200 status or stays up for many days.
Yes. You can add a small snippet using the template_redirect hook and wp_die() with a 503 status to a custom plugin or your child theme's functions.php, or use the wp maintenance-mode activate command in WP-CLI.
With most plugins and custom code, administrators can see the normal site while logged in. The built-in .maintenance file used during updates blocks everyone, including administrators.
An update was interrupted before WordPress could delete the .maintenance file in your site's root folder. Delete that file using your host's File Manager, FTP, or SSH, and your site will come back.
Maintenance mode is for existing sites that are temporarily down and should return a 503 status. Coming soon mode is for new sites that haven't launched yet and typically returns a 200 status so the page can be indexed.
Keep it as short as possible, ideally a few hours. If you need more time, consider doing the work on a staging site and pushing the changes live when they're ready.
Conclusion
Putting a WordPress site in maintenance mode is straightforward. A plugin like SeedProd, LightStart, or Maintenance gives you a polished page in minutes, a small code snippet does the same job without extra plugins, and WP-CLI or server rules handle deployments and migrations. Whatever you choose, make sure visitors see a clear message, search engines receive a 503 status, and administrators can still get in to do their work.
Keep your maintenance windows short, clear your caches afterward, and consider a staging site for larger projects. And if an update ever leaves your site stuck on "Briefly unavailable," you now know the fix: delete the .maintenance file, check that the update completed, and you're back in business.


