Do you need to put your WordPress site into maintenance mode and don’t know how? There are several methods depending on your technical level, from a simple plugin in a few clicks to editing your server files directly. Each has its advantages, and depending on the one you choose, you can quickly go from a clean holding page to a completely blocked site.
We are talking here about the “site under maintenance” holding page your visitors see. If you are rather looking for someone to look after your site day to day (updates, backups, security), that’s a different topic: let me introduce my WordPress maintenance.
Put WordPress into maintenance mode with a plugin
This is the easiest method if you’re a beginner. It only takes a few seconds and gives you a custom page without touching the code.
- Go to your WordPress Dashboard under Plugins > Add New.
- Type Maintenance in the search bar. I recommend the one simply called “Maintenance”, it is very lightweight.
- Click Install then Activate.
- Go to the plugin settings to switch the toggle to “On” and customise your message or your logo.
Good to know : Whatever the plugin, maintenance mode only applies to your visitors. You can still log in to your admin interface to work normally.
Maintenance mode via the functions.php file
If you want to avoid installing a plugin (which is technically cleaner to limit security risks), you can edit the functions.php file.
Warning : Only do this if you have a child theme, otherwise your changes will be erased at the next theme update. Connect to your server via SFTP (with FileZilla), locate your child theme’s functions.php file, and add this code at the very end:
function custom_maintenance_mode() { if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) { wp_die('Site under maintenance, please check back soon!', 'Maintenance', array('response' => 503)); } } add_action( 'get_header', 'custom_maintenance_mode' );
The advantage here is the use of the 503 code, which tells search engines that the unavailability is temporary. Your SEO is thus protected.
Enable maintenance mode with the .maintenance file
WordPress natively recognises a file named .maintenance. It’s a very quick but very basic method that displays a standard message.
Connect to your server via SFTP.
At the root of your site, create an empty file named .maintenance.
Add these lines to it:
<?php $upgrading = time(); ?>
The trap to avoid: This file is what sometimes causes the “Briefly unavailable for scheduled maintenance” message that stays stuck on some sites. If this happens to you after an update that crashed, simply delete this file via SFTP and your site will come back online immediately.
Create a custom maintenance page via .htaccess
On Apache 2.4, with mod_rewrite and the directives allowed by your host, this method returns an HTTP 503 response with your HTML page. It can leave you access to the site thanks to an exception for your IP address.
Create a maintenance.html file with your design and place it at the root of your site.
Back up your .htaccess file, then add these lines before the # BEGIN WordPressblock, without replacing the existing rules. The maintenance.html file must be self-contained, with its styles embedded, because other resources remain subject to maintenance.
ErrorDocument 503 /maintenance.html
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/maintenance\.html$ [NC]
RewriteCond %{REMOTE_ADDR} !^203\.0\.113\.10$
RewriteRule ^ - [R=503,L]
Replace the example address 203.0.113.10 with your public IPv4 address, keeping a backslash before each dot in the rule. With a proxy such as Cloudflare, ask your host to check that REMOTE_ADDR does match your real address before using this exception.
Test from another connection: the site’s pages should display maintenance.html with a 503 status, while your allowed IP keeps access. The ErrorDocument directive provides the error page: an R=503 rule alone does not redirect to its fallback address. After the work, remove only this added block, purge the caches and check the return to 200. See the Apache documentation on R=503.
To go further, you can consult the WordPress page on the most common errors (in English).
Do you have a WooCommerce store? It has its own setting: I explain how WooCommerce’s Coming soon mode works.
Your questions about WordPress maintenance mode
Which method to choose for your site?
To sum up, if you want a visual page with no effort, use the plugin. For a lightweight solution without an extension, prefer the functions.php. If you want full control with an exception for your IP, the .htaccess method is the most effective.
Finally, if your site displays an error message for no reason, always check whether a .maintenance file isn’t blocking your access at the server root.
If you’d rather delegate this technical part to sleep soundly, feel free to take a look at my WordPress maintenance plans. I take care of the updates and the security for you.