Status code
- Behavior
- 503 with the default message, set through
wp_die() - Source
wp_maintenance()source
Put WordPress in maintenance mode with core: the .maintenance file, a custom maintenance.php drop-in, fixing a stuck site, and the 503 and Retry-After rules for SEO.
WordPress core enters maintenance mode when a .maintenance file that sets $upgrading to a Unix timestamp exists in the site root, and it counts for 10 minutes. The updater creates and deletes that file during updates. You can brand the page with a wp-content/maintenance.php drop-in. For SEO, serve a 503 with Retry-After and never noindex.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
.maintenance in the WordPress root. In the core source, wp_is_maintenance_mode() returns false if that file does not exist, and otherwise loads it and compares the $upgrading timestamp it sets with the current time. Its description says: "If the file was created less than 10 minutes ago, WordPress is in maintenance mode."In the same folder as wp-config.php, create .maintenance with the line below, replacing the number with the current Unix time (date +%s prints it on Linux and macOS). The upgrader writes the same format when it starts an update.
Load the home page. Visitors get "Briefly unavailable for scheduled maintenance. Check back in a minute." with a 503 status. See the curl check below.
Delete .maintenance, or let the timestamp pass 10 minutes. The check returns false as soon as the file is gone.
The developer reference documents this file as the signal WordPress uses while it updates. Creating it by hand uses the same mechanism for a short window, so test each step on a staging copy first.
<?php $upgrading = 1792927329; ?>The timestamp stops counting after 10 minutes. The source treats a timestamp that is 10 minutes old or older as "maintenance over", so a hand-made file covers a short window only. Core documents nothing beyond that window. For longer planned downtime, return the 503 from your web server or host instead, or write a fresh timestamp before the old one expires.
wp_die()wp_maintenance() sourceRetry-After: 600 with the default messagewp_maintenance() sourcewp_maintenance() sourcewp-content/maintenance.php replaces the default messagewp_maintenance() referencewp_is_maintenance_mode() sourcewp-settings.php sourcewp_maintenance() reference, if a maintenance.php file exists in wp-content, WordPress loads it instead of the default message. In the current release (7.1.3 at the time of writing) and in the developer reference, that branch requires the file and ends the request without setting a status code or Retry-After, so the drop-in has to send both itself. The 6.9 and 7.0 branches have the same code. WordPress functions such as status_header() are not loaded yet at that point, so the drop-in uses plain PHP. The development source for 7.2 (trunk, marked @since 7.2.0) adds the 503 status, no-cache and Retry-After: 600 headers before loading the drop-in. Sending them yourself works in both.Google advises static HTML, few off-page resources (inline CSS and base-64 images), and clear guidance on the error page, such as the date you expect to be back and how to contact support. Do not add a noindex meta tag to the template. The Retry-After value above is an example, so set your own best estimate of the duration.
The enable_maintenance_mode filter, added in 4.6.0, receives $enable_checks and $upgrading. Per its description it "is designed for non-web runtimes", and returning false lets the request continue despite maintenance mode.
<?php
http_response_code( 503 );
header( 'Retry-After: 3600' );
header( 'Content-Type: text/html; charset=utf-8' );
?>
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Back soon</title></head>
<body>
<h1>We are doing maintenance</h1>
<p>We expect to be back by 3 pm UTC. Questions: support@example.com</p>
</body>
</html>.maintenance behind. A timestamp that is 10 minutes old or older no longer counts, so the site recovers by itself after that. If the message does not go away, delete the file.Look in the same directory as wp-config.php. The name starts with a dot, so turn on hidden files in your SFTP client or file manager.
Removing .maintenance ends maintenance mode, the same thing the upgrader does when it finishes.
Run the failed update again from Dashboard > Updates, then confirm the home page returns 200.
If the site still shows the message after the file is gone, look for a wp-content/maintenance.php drop-in or a server-level maintenance page, since both can produce their own page.
"If you need to urgently disable the site for 1-2 days, then return an informational error page with a 503 HTTP response status code instead of all content."
Google says to use the retry-after HTTP header with a best effort date or duration, and static HTML.
For a longer closure Google says to provide an indexable home page as a placeholder with a 200 status code. It recommends limiting site functionality over disabling the site, and calls disabling not recommended.
Google says not to block the website with 403, 404 or 410 status codes, or with a noindex robots meta tag or x-robots-tag header, because this will remove the website's URLs from Google Search.
Do not return a 503 for robots.txt, because this blocks all crawling, and do not disallow all crawling.
5xx and 429 responses make Google temporarily slow down. Already indexed URLs are preserved, but eventually dropped, and content from 5xx responses is ignored. Google raises the crawl rate gradually once 2xx responses return.
Google also warns that its systems cannot refresh titles, descriptions, metadata or structured data on a page that returns a 503.
The first should show HTTP/1.1 503 Service Unavailable (or HTTP/2 503) and a retry-after header, and should not return 200 or a redirect. The second must not return a 503 per Google. If it does, the maintenance rule is catching robots.txt too. For more on those rules see WordPress robots.txt and the 5xx server errors issue.
Other platforms handle this differently: see Drupal maintenance mode, Laravel maintenance mode and the HTTP 503 error.
curl -I https://example.com/
curl -I https://example.com/robots.txt4 questions people ask next, answered from the sources on this page.
Create a .maintenance file in the site root, next to wp-config.php, containing <?php $upgrading = 1792927329; ?> with the number replaced by the current Unix time. Core then answers requests with a maintenance message and a 503 status for 10 minutes, or until you delete the file. Core documents the file as the updater's signal, so test it on staging first.
503. With the default message, core sends it through wp_die() along with a Retry-After: 600 header. In the current 7.1 release, a wp-content/maintenance.php drop-in must send its own 503 and Retry-After.
Delete the .maintenance file in the site root, or wait until its timestamp is 10 minutes old. The file is hidden, so turn on hidden files in your SFTP client.
A short 503 with Retry-After is what Google advises for 1-2 days. Longer closures call for an indexable 200 placeholder, and Google says closing a site even for a few weeks can have negative consequences for indexing. Never use noindex, 404 or 403 for maintenance.
Run the free audit, then approve the fixes. Every change can be undone.