Do you need to make updates or changes to your site without your visitors running into errors when they try to access your site? Putting your WordPress site in maintenance mode is the ideal solution.

This will allow you to temporarily suspend public access to your WordPress site, while continuing to work on it behind the scenes.

In this tutorial, we’ll show you how to enable and disable maintenance mode on WordPress, either with a plugin or manually.

You’ll also discover why this feature is essential and how to manage it easily, even if you’re a complete novice.

Are you ready? Follow the guide!

Your WordPress projects need the best hosting!

WPMarmite recommends SiteGround: great performance, great support. All you need for a great start.

Try SiteGround
SiteGround logo

What is WordPress maintenance mode?

Maintenance mode on WordPress makes your site temporarily inaccessible to visitors by displaying a page indicating that work is in progress. Logged-in administrators, on the other hand, can continue to work normally on the site during this period.

This mode is particularly useful for:

  • Updating your WordPress version, plugins, or themes
  • Modifying the design or content of the site
  • Correcting bugs or optimizing technical performance
  • Etc.

By using maintenance mode, you protect the user experience on your site, avoid display errors (such as broken pages or error messages) and maintain a professional image.

And that’s not all: by correctly activating maintenance mode with an HTTP 503 code, you signal to search engines that your site’s unavailability is only temporary. This preserves your natural search engine optimization (SEO).

How do I activate and deactivate WordPress maintenance mode with a plugin?

To activate maintenance mode on WordPress, using a plugin is often the simplest solution, especially if you don’t want to touch the code.

Introducing the Maintenance Mode for WordPress® plugin

Among the many maintenance plugins available, Maintenance Mode for WordPress® stands out for its simplicity, flexibility, and efficiency.

It makes it easy to activate or deactivate the maintenance mode, while offering options for personalizing the message displayed to visitors.

This 100% free plugin, created by developer Robert DeVore, allows you to:

  • Activate one-click maintenance mode, blocking access to visitors while allowing administrators to work
  • Customize the maintenance page with the WordPress content editor
  • Preserve your site’s SEO by automatically returning an HTTP 503 code, letting search engines know that your site will soon be back

Whatever type of site you manage, this plugin should make it easy to put your WordPress site into maintenance mode.

Configuring Maintenance Mode forWordPress®

Here’s how to use Maintenance Mode for WordPress® to enable and disable maintenance mode and customize your maintenance page:

  1. Install the plugin by downloading it from the developer’s GitHub.

If you’d like to know how to install a WordPress plugin properly, check out our complete guide.

  1. Go to Maintenance > Settings.
The WordPress sidebar with the "Settings" button under "Maintenance" highlighted in red.

Check the “Enable maintenance mode” option. This blocks access to the site for visitors, while allowing you to browse and work on it as administrator.

You can also specify a launch date.

The Maintenance Mode for WordPress settings page with the "Launch Date" box highlighted in red and a red arrow pointing to "Enable Maintenance Mode."
  1. Customize the maintenance page:
    • Add a custom message, for example: “Maintenance in progress, we’ll be back soon!”
    • Insert a logo, a background image, or a countdown to the end of the maintenance.
    • Adjust the colors and the layout to suit your visual identity.
Customizing the maintenance page with the Maintenance Mode for WordPress plugin.
  1. Finally, to deactivate maintenance mode, return to the plugin settings and uncheck the “Enable maintenance mode” option, or deactivate the plugin if you no longer need it.

Join the WPMarmite subscribers

Get the last WPMarmite posts (and also exclusive resources).

WPMarmite English newsletter

How to enable and disable WordPress maintenance mode manually

If you’d rather avoid plugins, here are two manual methods of enabling maintenance mode on WordPress. These approaches require a little caution, so remember to back up your site before you start.

Method 1: Use the .maintenance file

  1. Creating a .maintenance file

Connect to your server via FTP (with FileZilla, for example) or use your host’s file manager.

Go to the root directory of your WordPress site (often /public_html).

Create a file named .maintenance (don’t forget the dot at the beginning).

  1. Add code

Open the .maintenance file and insert:

<?php 
$upgrading = time();

Save and upload. This immediately activates maintenance mode.

  1. Maintenance mode deactivation

To deactivate maintenance mode, delete the .maintenance file once you’ve completed your changes.

Method 2: Using functions.php

You can also modify your theme’s functions.php file to enable WordPress maintenance mode, by following these steps:

  1. Accessing functions.php

If you’re using a classic theme, go to the “Appearance” menu in your WordPress administration, then click on “Theme file editor.”

The WordPress sidebar with the "Theme File Editor" button under "Appearance" highlighted in red.

If you’re using a block-based WordPress theme, go to Tools > Theme File Editor.

In the right-hand column, a list of files is displayed. Select the functions.php file to make changes directly in the editor.

  1. Add code

Add the following code to the end of the file, then click on “Update file”:

function wpmarmite_global_maintenance_mode() {
// Autoriser les utilisateurs connectés avec droits admin
if (current_user_can('edit_themes') && is_user_logged_in()) {
return;
}
// Autoriser l'accès au wp-login, à l'admin, et aux appels AJAX (sinon problème de connexion)
if (is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) {
return;
}
// Message HTML personnalisé
$html = '
<h1>Maintenance en cours</h1>
<p>Notre site est temporairement en maintenance. Revenez dans quelques minutes !</p>
<p>Pour toute urgence : <a href="mailto:contact@votresite.com">contact@votresite.com</a></p>
';
// Affichage du message avec code HTTP 503 (Service temporairement indisponible)
wp_die($html, 'Site en maintenance', array('response' => 503));
}
// Hook pour bloquer les visiteurs sur les pages classiques
add_action('template_redirect', 'wpmarmite_global_maintenance_mode');
// Hook pour bloquer aussi les requêtes API REST, RSS, etc.
add_action('init', 'wpmarmite_global_maintenance_mode');

This will trigger the display of the default WordPress maintenance screen. However, it is possible to modify the code to customize the HTML message displayed on the screen.

To do this, modify the HTML code below ” // Custom HTML message ” and replace this content with the message of your choice.

The maintenance mode message in WordPress.
  1. Maintenance mode deactivation

Once you’ve finalized your changes, remember to remove the code inserted in the functions.php file to restore your WordPress site to full functionality and deactivate maintenance mode.

Warning: An error in functions.php can render your site inaccessible. Always save your site before making any changes!

A man taps his forehead.

Why activate maintenance mode on WordPress?

Enabling maintenance mode on WordPress offers several key advantages:

  • Protect your visitors: Make sure they don’t see a messy site or errors during your modifications
  • Preserve your SEO: A maintenance page with a 503 code signals to Google a temporary unavailability, unlike a 404 or 500 error
  • Work with peace of mind: Update without fear of interaction with an unstable site
  • Enhance your image: A professional maintenance page, like the one offered by Maintenance Mode for WordPress®, reinforces your credibility.

Conclusion

Now you know how to enable and disable maintenance mode on WordPress, whether with the Maintenance Mode for WordPress® plugin or via manual methods such as the .maintenance or functions.php file.

This feature allows you to maintain a professional site, while preserving your SEO, credibility, and user experience.

So, ready to put your site on pause for some stress-free tweaking? Share your questions or tips in the comments 😉